I've run into this in perl 5.6 (not perl 5.8) before as well. It typically seems to happen when $1 is bound in a lexical context where it is already bound. I've had to work around by doing things like: my ($fname) = ($aif->{fpath} =~ /\/encyclopedia\/(.*)\/index\.html$/ ); if ($fname) { print "foo $fname"; -mda