Owen <rc...@pcug.org.au> asked: > I have this statement; > > foreach my $key ( keys %filehash ) { > print "$key $filehash{$key}->[0]\t\t\t$filehash{$key}->[3]\t > $filehash{$key}->[2]\t $filehash{$key}->[1]\n"; > } > > but wish to sort the output by $filehash{$key}->[0]. Is it possible? > How do I do this?
foreach my $key ( sort { $filehash{$a}->[0] cmp $filehash{$b}->[0] } keys %filehash ){ ... } HTH, Thomas -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/