#!/usr/bin/perl -w use strict; my @array=(-3,-4,-2); my $max=shift @array ; foreach (@array) { if (/^-?\d+$/) { $max=$_ if ($_>$max) } } print $max;