in reply to pattern matching and return values

If you put the match operation in list context, you can gobble up the matched items:
if( my($a, $c) = $string =~ /(a).*(c)/ ) { print "a=$a c=$c\n"; }
To store them in a hash,use a hash slice to assign them:
@result{"a","b"} = $string =~ /(a).*(c)/;

Replies are listed 'Best First'.
Re^2: pattern matching and return values
by Anonymous Monk on Jul 18, 2004 at 05:32 UTC
    great, thanks f.