in reply to Re^2: Use of uninitialized value $1
in thread Use of uninitialized value $1
I'm not sure that is true. I remember a node that fairly recently talked about this, but I couldn't find it, only What's happening to my $1?.
What I remember is that a failed match could in some circumstances modify $1. So $1 is only reliable if the match succeeds (can't rely upon it being what it was after the previous regex after a failed match). I also remember that this behavior is Perl version specific.
I haven't run across this in my code as I do whatever I'm going to do with $1 right after the regex and have never written code that decides whether $1 changed or not. I only use $1 if the match succeeded.
Yes, this is a nit, but Perl Monks is good about resolving these nits and details.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Use of uninitialized value $1
by AnomalousMonk (Archbishop) on Aug 26, 2016 at 01:06 UTC | |
by Marshall (Canon) on Aug 26, 2016 at 03:15 UTC |