in reply to Pattern match
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".use strict; use warnings; my $string = shift; if ( $string =~ /received 486 response/ ) { print "matched $string\n"; } else { print "did not match $string\n"; }
So maybe what ever is inside your variable is indeed not what you think it is <.<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
|
|---|