#!/usr/bin/perl -w use strict; $|=1; #turns off buffering for STDOUT my @x = ( [1,'100'], [2,'106'], [3,'100A'], [4,'100B2'], ); foreach my $ref (@x) { print "For $ref->[1] compareLT105 says: ", compareLT105($ref),"\n"; } sub compareLT105 { my $arrayRef = shift; local $SIG{__WARN__} = sub { my $msg = shift; print STDERR $msg,"********"; print STDERR "error array index: ",$arrayRef->[0]; print STDERR " value is ",$arrayRef->[1], "\n"; }; return 'true' if $arrayRef->[1] < 105; return 'false'; } __END__ For 100 compareLT105 says: true For 106 compareLT105 says: false Argument "100A" isn't numeric in numeric lt (<) at C:\TEMP\warnexample.pl line 30. ********error array index: 3 value is 100A For 100A compareLT105 says: true Argument "100B2" isn't numeric in numeric lt (<) at C:\TEMP\warnexample.pl line 30. ********error array index: 4 value is 100B2 For 100B2 compareLT105 says: true