my $String="1234A4321"; my $RegEx="/a/i"; #### { $String=~/a/i; print "Match: ",$&||"none"," Pre: ",$`||"none"," Post: ",$'||"none","\n"; } #### { $String=~$RegEx; print "Match: ",$&||"none"," Pre: ",$`||"none"," Post: ",$'||"none","\n"; } { eval $String=~$RegEx; print "Match: ",$&||"none"," Pre: ",$`||"none"," Post: ",$'||"none","\n"; } { eval { $String=~$RegEx; }; print "Match: ",$&||"none"," Pre: ",$`||"none"," Post: ",$'||"none","\n"; }