in reply to Reference to sort results
Yes, it is possible to pass a reference to an array to be sorted like below, but why bother? You have a one line thing that sorts "stuff".
#!/usr/bin/perl -w use strict; my @a = (4,5,1,2); print "@a\n"; sort_ref_2_array (\@a); print "@a\n"; sub sort_ref_2_array { my $aref = shift; @$aref = sort @$aref; } __END__ prints: 4 5 1 2 1 2 4 5
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Reference to sort results
by Anonymous Monk on Aug 05, 2009 at 13:19 UTC | |
by ssandv (Hermit) on Aug 05, 2009 at 15:22 UTC | |
by Anonymous Monk on Aug 06, 2009 at 10:42 UTC | |
by ssandv (Hermit) on Aug 06, 2009 at 15:18 UTC | |
by Marshall (Canon) on Aug 07, 2009 at 00:09 UTC | |
by omnifish (Initiate) on Aug 10, 2009 at 09:45 UTC | |
|
Re^2: Reference to sort results
by Anonymous Monk on Aug 05, 2009 at 13:23 UTC |