in reply to Re: Re: Re: slurping into a substring'ed' array
in thread slurping into a substring'ed' array

grep checks against %seen and, the first time, sees that it's zero (false), so doesn't pass it through. The second time, it's non-zero (true), so it passes that value through. The third and subsequent times, it's still true. Your grep would have dropped all unique values. (If you had a D123, for instance, it would have been missed.)

If you absolutely have to have it in one line, provide a function called unique() and do something like:

sub unique { my %x; @x{@_} = @_; values %x } my @sorted = sort { $a cmp $b } unique map { substr($_, 0, 1 ) } @original;

------
We are the carpenters and bricklayers of the Information Age.

Then there are Damian modules.... *sigh* ... that's not about being less-lazy -- that's about being on some really good drugs -- you know, there is no spoon. - flyingmoose