You need list context to assign the capture(s) — note the parentheses around $ports:
my ($ports) = $args =~ m/-p\s+([-\d]+)/;
Otherwise (in scalar context), you'd get whether the regex matched (thus the 1).
In reply to Re^3: find element in array, then advance to next element
by almut
in thread find element in array, then advance to next element
by kathys39
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |