gitarwmn has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/local/bin/perl use strict; my $file = "input.log"; my @sorted_ages; open (IN, $file) || die "Couldn't find '$file': $!"; while (my $line = <IN>){ my @age; my ($name, $personsage) = split(",",$line); @age = split("\n",$personsage); @sorted_ages = sort {$b <=> $a} @age; } close (IN); foreach my $a (@sorted_ages){ print $a; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Using file handles
by TedYoung (Deacon) on Nov 23, 2004 at 21:14 UTC | |
|
Re: Using file handles
by ikegami (Patriarch) on Nov 23, 2004 at 21:19 UTC | |
|
Re: Using file handles
by bobf (Monsignor) on Nov 23, 2004 at 21:18 UTC | |
|
Re: Using file handles
by TedPride (Priest) on Nov 23, 2004 at 22:27 UTC | |
by ikegami (Patriarch) on Nov 23, 2004 at 23:29 UTC | |
|
Re: Using file handles
by apotheon (Deacon) on Nov 24, 2004 at 05:51 UTC |