Yes, your code is more readable and fail safe. Also I was not aware of the performance penalty in using $&, so thanks for teaching me something too. I am still learning Perl.
Wiggins d Anconia wrote:
[snip]
This should give you what you need:
my $digit = 0; foreach (@commands) { /^\d+/; print FILE "DIGIT = $&\n"; }
While simple, use of $& takes a performance penalty and a readability penalty....
From perldoc perlvar:
"The use of this variable anywhere in a program imposes a considerable performance penalty on all regular expression matches. See the BUGS manpage."
http://danconia.org
-- Flemming Greve Skovengaard The killer's breed or the Demon's seed, a.k.a Greven, TuxPower The glamour, the fortune, the pain, <[EMAIL PROTECTED]> Go to war again, blood is freedom's stain, 4168.08 BogoMIPS Don't you pray for my soul anymore.
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>