in reply to Pattern match

use strict; use warnings; my $string = shift; if ( $string =~ /received 486 response/ ) { print "matched $string\n"; } else { print "did not match $string\n"; }
Ran it with 'script.pl "received 486 response"' and it worked as intended. It does not match "received 485 response" or "received 480 response" or "received 487 response".

EDIT: Maybe you should post some code other that the pattern match, so we can see what is going on.

EDIT2: Here is another example:
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
So maybe what ever is inside your variable is indeed not what you think it is <.<