rethaew has asked for the wisdom of the Perl Monks concerning the following question:
So that if $something, it will sort the array in reverse, otherwise $sorter doesn't exist and it will sort the array default. Basically I want to use a variable as perl syntax.my $sorter; if ($something){$sorter='reverse';} foreach ($sorter sort @array ) { blah; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Reverse sort array
by ikegami (Patriarch) on Aug 19, 2009 at 22:22 UTC | |
by rethaew (Sexton) on Aug 19, 2009 at 22:30 UTC | |
by AnomalousMonk (Archbishop) on Aug 19, 2009 at 22:41 UTC | |
by ikegami (Patriarch) on Aug 20, 2009 at 02:50 UTC | |
by rovf (Priest) on Aug 20, 2009 at 08:51 UTC | |
by ikegami (Patriarch) on Aug 20, 2009 at 14:40 UTC | |
|
Re: Reverse sort array
by Tanktalus (Canon) on Aug 19, 2009 at 22:29 UTC | |
by rethaew (Sexton) on Aug 19, 2009 at 22:36 UTC | |
|
Re: Reverse sort array
by AnomalousMonk (Archbishop) on Aug 19, 2009 at 22:34 UTC | |
by johngg (Canon) on Aug 20, 2009 at 13:24 UTC |