On 07/25/2006 08:32 PM, macromedia wrote:
Hi,
I can't seem to get my script to sort properly. [...]
Here is a shortened version of your program:
use strict;
use warnings;
use File::Slurp;
my %tags;
foreach my $line (read_file 'sort_tags.dat') {
if ($line =~ m/id=(\d*)([[:alpha:]]*)/) {
$tags{sprintf("%04d%6s",$1 || 999,$2)} = $line;
}
}
write_file('sort_tags.out',
map $tags{$_}, sort keys %tags);
__END__
As in the other program, I used sprintf() to create
easily-sorted keys.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>