Your assignment to "my $var" is in a scalar context.
The result of the regular expression is a single item in a list context.
You can get the desired result by:
my ($var) = $line =~ /.*?:(\w+):.*?$/; # Declare $var in a List contex +t.
Potentia vobiscum ! (Si hoc legere scis nimium eruditionis habes)
In reply to Re^3: Regular Expression
by NetWallah
in thread Regular Expression
by Sun751
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |