in reply to Re: Regex returns match the first time. It returns everything thereafter
in thread Regex returns match the first time. It returns everything thereafter

Yes I am using warnings and there are no undefined value messages.

  • Comment on Re^2: Regex returns match the first time. It returns everything thereafter

Replies are listed 'Best First'.
Re^3: Regex returns match the first time. It returns everything thereafter
by AnomalousMonk (Archbishop) on Nov 18, 2013 at 15:13 UTC

    This could be explained if  $_ had been assigned a defined value by some operation previous to the code shown in the OP.

    The other twist I noticed is that the regex is really  /\Z/ and not  /\\Z/. The former regex matches everything, even undef (although a warning is still generated for a match against undef if warnings are enabled).