in reply to sorting numbers
A few things to get you going.
First, to pull the 't=' numbers out of the file, you need to use backreferences. That's when you put something in parens in a regular expression, like so:
If $_ werem/A t=(d*)/; my $t_val = $1;
then $t_val would be 40.hello A t=40a30
Next, you need to use sort. sort operates on a list, like so:
The result is:my @list = ('my', 'bonnie', 'lies'); foreach my $word (sort @list) { print $word, "\n"; }
bonnie lies my
sort normally sorts alphabetically. To sort numerically, see the perlfunc:sort manual page.
To collect all of these numbers into a list, you'll need push. Now all you need to do is put these pieces together. :)stephen
|
---|
In Section
Seekers of Perl Wisdom