To further Corion's excellent advice, you most likely don't need to directly use $1, $2, etc. either. This code:
Is most often better written like so:my $str = 'hello world'; $str =~ /^(\S+)\s/; print $1;
In other worsds, capture your match in your own variable. :)my $str = 'hello world'; my ($match) = $str =~ /^(\S+)\s/; print $match;
jeffa
L-LL-L--L-LL-L--L-LL-L-- -R--R-RR-R--R-RR-R--R-RR B--B--B--B--B--B--B--B-- H---H---H---H---H---H--- (the triplet paradiddle with high-hat)
In reply to Re: Switch and $1?
by jeffa
in thread Switch and $1?
by pianogirl95
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |