I said it in the CB already:
Never use an unguarded assignment after a regex match. Always door dodie "No data found" unless /...(...)/; my $value = $1;/my $value; if (/...(...)/) { $value = $1 };
In your case, this amount to:
... my $port = '<no port found>'; if ($line =~/(port=([0-9]+))/i) { $port= $2; };
In reply to Re: matching patterns
by Corion
in thread matching patterns
by theroninwins
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |