[Please do not top-post replies. Please trim reply-quoted material to
the minimum necessary to establish context. See the clpm posting
guidelines at
http://mail.augustmail.com/~tadmc/clpmisc.shtml for
explanations and other good advices.]
: "Chris Mattern" <
[email protected]> ??? ???...
: > mkl wrote:
: > > If I have a file ,named txt
: > >
: > > ###############
: > > a (298:298) (9:9)
: > > b (2:2)
: > > c (3:3)
: > > d (5:5)
: > > ############################
: > >
: > > how do i select the biggest one and print ?
: > >
: > Biggest what? And how are you determining
: > that x is bigger than y?
:
: I want to compare number and print the whole line,
: I know the biggest value is 298 in this file and
: print a (298:298) (9:9)
Have you tried writing any code on your own yet?
One possible way,
use List::Util qw(reduce max);
my $big = reduce{max($a=~/\d+/g)>max($b=~/\d+/g)?$a:$b} <DATA>;
__DATA__
a (298:298) (9:9)
b (2:2)
c (3:3)
d (5:5)