See perldoc perlop for more info on various combinations of m//, /g and what they return in list and scalar context.use strict; my $file = 'file013.txt'; my ($sk) = $file =~ m/(\d+)/; # list context to get what () captured print $sk;
Update: Corrected typo.
In reply to Re: Regex not behaving as expected
by Paladin
in thread Regex not behaving as expected
by Popcorn Dave
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |