in reply to Re: Use of uninitialized value in pattern match (m//)
in thread Use of uninitialized value in pattern match (m//)
my $tmp2 = $2;
This does not make $tmp2 defined if $2 is undefined. Don't you mean something like:
Or, if you have the defined-or patch installed, something like:my $tmp2 = length $2 ? $2 : '';
my $tmp2 = $2 // '';
Liz
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: Use of uninitialized value in pattern match (m//)
by Anonymous Monk on Jun 26, 2009 at 11:59 UTC | |
by davorg (Chancellor) on Jun 26, 2009 at 12:15 UTC |
In Section
Seekers of Perl Wisdom