http://www.perlmonks.org?node_id=821031


in reply to Have a sort of trouble.

Hi, $a and $b already contain the file path; if you want to sort by the path, just use them:

What about this?

for my $apache_file ( sort { $a cmp $b } keys( %{ $merge_structure{ ap +ache_log }\ } ) ) { print "$apache_file\n"; }

If you don't want to sort by the file path you should tell us, by what you want to sort.

The file path is the key, you are sorting by the value, whatever that may be...

Replies are listed 'Best First'.
Re^2: Have a sort of trouble.
by dbmathis (Scribe) on Feb 02, 2010 at 20:48 UTC
    Duh, thank you! That's what happens when you don't write perl for a year :)