NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.
All the Perl that's Practical to Extract and Report
Stories, comments, journals, and other submissions on use Perl; are Copyright 1998-2006, their respective owners.
Why so convoluted? Use a literal slice! (Score:2)
Re:Why so convoluted? Use a literal slice! (Score:2)
Peace,
Jason
min() (Score:2)
That code is very confusing. Sorta like taking a flight from NY to LA by via Johannesburg and Perth. Why not just grab the smallest element of the list?
If you needed to avoid List::Util for some odd reason, I don't know why you would sort a list, reverse it and take the last element (in a most convoluted fashion) when you could just:
Re:min() (Score:2)
Hmmm -- maybe this won't even see the light of day in my import script now.
Peace,
Jason
Re: (Score:1)
I thought it was common knowledge that there is no such thing as a list in scalar context. :-)
The context issues are particularly important when you
returnthings.my $foo = bar();will produce a different result with abarfunction that doesreturn @arr;vs one that doesreturn ( $baz1, $baz2, $baz3 ). This is even more insidious if you do something likereturn grep quux($_), @arr.Always mind your context.
Your particular example, btw, besides all the issues already pointed out by others, should at l