- #1
Monique
Staff Emeritus
Science Advisor
Gold Member
- 4,149
- 64
How do you return the largest numeric value in an array, in Perl?
I don't think perl has a maximum function so you have to do something likeMonique said:How do you return the largest numeric value in an array, in Perl?
my $tmp='';
map {$tmp=$_ if ($_>$tmp and $_=~/^-?\d*.?\d*$/s and $_=~ /\d/} @array
die("The array doesn't contain any numbers ") unless ($tmp=~ /\d/);
return $tmp;
if ($frame1>$frame2&&$frame3){
$ORF=$frame1;
} elsif ($frame2>$frame3){
$ORF=$frame2;
} else {
$ORF=$frame3;
}
I'm not familiar with Perl syntax, but don't you mean something like ($frame1>$frame2)&&($frame1>$frame3)? (In other languages, at least, the two are much different)$frame1>$frame2&&$frame3