my ($LSV, $LSN) = $BE_temp =~ m/^\|\s(\w+_\d+)\s+\|\s+(\w+)\s+\|$/m;
if ( $LSV =~ m/dsmgt_03_03/ ) { ... }
If the initial match against $BE_temp fails, the subsequent match against $LSV will produce a "Use of uninitialized value $LSV in pattern match ..." warning (not error) because $LSV et al are undefined. The initial match should be tested in some way and subsequent matches (or uses of the extracted strings) made dependent on a successful initial match, e.g.:
if (my ($LSV, $LSN) = $BE_temp =~ m/^\|\s(\w+_\d+)\s+\|\s+(\w+)\s+\|$/ +m) { do_something_with($LSV); do_something_with($LSN); }
In reply to Re^2: Issues With Regex
by AnomalousMonk
in thread Issues With Regex
by ImJustAFriend
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |