use strict; use warnings; my $string = shift; if ( $string =~ /received 486 response/ ) { print "matched $string\n"; } else { print "did not match $string\n"; } #### my @array = ( "received 480 response", "received 485 response", "received 486 response", "received 487 response" ); for (@array) { if ( $_ =~ /received 486 response/ ) { print "matched $_\n"; } else { print "did not match $_\n"; } } ________________________________________________ Output is: F:\>script.pl did not match received 480 response did not match received 485 response matched received 486 response did not match received 487 response