Don't test for a match if there is no line:
if (defined $line and $line =~ /(\bTest\b\s+.+\s+\baccount\b)?/)
(Update: added parens to handle precedence of //, thx to choroba)if ( ($line // '') =~ /(\bTest\b\s+.+\s+\baccount\b)?/)
Hope this helps!
In reply to Re: Preventing Use of uninitialized value.
by 1nickt
in thread Preventing Use of uninitialized value.
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |