$_ = "abcde"; if (/(.)(.)/) { # first two { # ADDED if (/(.)(.)$/) { # last two, by your theory won't upset print "inner: $1 $2\n"; } } # ADDED # by your theory, should see first two again print "outer: $1 $2\n"; }