Clear questions and runnable code get the best and fastest answer |
|
PerlMonks |
Re: Perl parser gets confused with call to "sort" w/o parensby choroba (Cardinal) |
on May 16, 2018 at 11:09 UTC ( [id://1214639]=note: print w/replies, xml ) | Need Help?? |
This is documented in sort:
Warning: syntactical care is required...
Is interpreted as
i.e. it uses uniq as the sorting function. Update: In Perl 5.18.2., I'm not getting the numeric behaviour, it just fails with
In blead perl, though, I'm getting the same warning as you. Update 2: The numeric context is forced even when I use uniqstr instead of uniq. That's probably because Perl first calls which returns 'q', 'w', and sort tries to use this value as -1, 0, or 1, etc. This enforces the scalar numeric context probably.
In Section
Seekers of Perl Wisdom
|
|