>perl -wMstrict -le "my $s = 'foobar'; printf qq{\$& in sub: '%s' \n}, S($s); print qq{\$& post sub: '$&'}; print '$& undefined' unless defined $&; ;; sub S { $_[0] =~ m{ oob }xms; return $&; } " $& in sub: 'oob' Use of uninitialized value $& in concatenation (.) or string at ... $& post sub: '' $& undefined