Subject: | List::Util::uniq evaulation context |
The attached test case utluniqtest.pl suggests that utl->uniq always evaluates in the scalar context:
Source - One Fish Two Fish Red Fish Blue Fish
List::Util::uniq - One Fish Two Red Blue
utl->uniq - 5
coerce A - 5
coerce B - 5
utl->shuffle - Blue Fish Fish One Fish Red Two Fish
utl->shuffle works as expected, indicating that uniq is behaving differently from other List::Util functions.
Util::Utl: 0.0011
List::Util: 1.46
perl 5, version 18, subversion 1 (v5.18.1)
Linux 3.12.62-55-desktop x86_64 x86_64 x86_64 GNU/Linux
Thanks for considering this,
Tom
Subject: | utluniqtest.pl |
use 5.010;
use strict;
use warnings;
use Util::Utl;
my @title = qw(One Fish Two Fish Red Fish Blue Fish);
say "Source - @title";
my @result;
@result = List::Util::uniq(@title);
say "List::Util::uniq - @result";
@result = utl->uniq(@title);
say "utl->uniq - @result";
@result = (utl->uniq(@title));
say "coerce A - @result";
@result = @{[utl->uniq(@title)]};
say "coerce B - @result";
@result = utl->shuffle(@title);
say "utl->shuffle - @result";