in reply to REGEXP: only need last matching string

$1 will contain the last match if you execute the regexp in list context.
(my $dum) = $str =~/abc\s(\d+)/g ; print "dum is $1\n" ;
gives
dum is 14

Replies are listed 'Best First'.
Re^2: REGEXP: only need last matching string
by blazar (Canon) on Dec 23, 2005 at 12:24 UTC
    Then
    () = $str =~ /abc\s(\d+)/gs;
    will suffice, i.e. no need for the $dum variable.