in reply to Switch and $1?

To further Corion's excellent advice, you most likely don't need to directly use $1, $2, etc. either. This code:

my $str = 'hello world'; $str =~ /^(\S+)\s/; print $1;
Is most often better written like so:
my $str = 'hello world'; my ($match) = $str =~ /^(\S+)\s/; print $match;
In other worsds, capture your match in your own variable. :)

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)