sort() is an inbuilt function. It returns a sorted version of the array you pass it. If you want to keep that sorted array you need to assign it to an array. This is a lazy way to do it!
When you say sort @d you are actually saying sort { $a cmp $b } @d where $a and $b are magical vars that hold sequential pairs of elements in the sort. You use cmp to get an alphabetic sort and <=> to get a numeric one. If you want reverse the sort order you transpose the $a and $b. You can have very complex code in the block preceeding the sort because you have access to the sequential pairs in $a and $b. The default is { $a cmp $b } which is an ascending order aphabetic sort.
If you want wild, wicked and short look into grep and map in perlman:perlfunc.
cheers
tachyon
s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print
In reply to Re: UnPerl-like Code
by tachyon
in thread UnPerl-like Code
by jerrygarciuh
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |