superfrink has asked for the wisdom of the Perl Monks concerning the following question:
And the code:Use of implicit split to @_ is deprecated at ./tie-listkeyshash-test.p +l line 31. Use of implicit split to @_ is deprecated at ./tie-listkeyshash-test.p +l line 32.
my @paths = ( "C:\\foo\\bar", "C:\\foo\\bar\\baz", "C:\\car", ); print "paths", Dumper(\@paths); @paths = sort { scalar (split (/\\/ , $b)) <=> scalar (split (/\\/ , $a)) } @paths; print "paths", Dumper(\@paths);
sub dir_component_count($) { my $path = shift; my @components = split /\\/ , $path; return scalar (@components); } @paths = sort { dir_component_count($b) <=> dir_component_count($a) } @paths;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Sort path strings by component count.
by Roy Johnson (Monsignor) on Feb 24, 2006 at 18:45 UTC | |
|
Re: Sort path strings by component count.
by ikegami (Patriarch) on Feb 24, 2006 at 18:49 UTC | |
|
Re: Sort path strings by component count.
by doom (Deacon) on Feb 25, 2006 at 01:05 UTC | |
by Roy Johnson (Monsignor) on Feb 27, 2006 at 15:57 UTC | |
|
Re: Sort path strings by component count.
by kaif (Friar) on Feb 25, 2006 at 21:03 UTC |