in reply to regex problem

$1,$2 ... has to match parens, if there is only one set of parens, $2 can NEVER be defined
'stuff' =~ /(.).../; print "$1\n"; 'stuff' =~ /(.).(.)./; print "$1 $2\n"; 'stuff' =~ /(.).(.).(.)/; print "$1 $2 $3\n"; __END__
More in perlre,perlretut