Perl Monk, Perl Meditation | |
PerlMonks |
Re: RegExp eating my $1by busunsl (Vicar) |
on Jul 31, 2008 at 21:30 UTC ( [id://701534]=note: print w/replies, xml ) | Need Help?? |
I haven't run your program yet, but a few things struck my eyes:
Regexes are not always better/faster than anything else, in this case the substr function might be better. my $ffc = substr($line, 0, 6); If you want to assign the captured part of a match to a variable, you can do it like this: my ($foo) = $bar =~ /(...)/; Mind the parenthesises around $foo, the match returns a list of values.
Your loop through the keys of %files is uneccessary, use the exists function. Perhaps you might be able to streamline your program a bit, so that the error is more obvious.
In Section
Seekers of Perl Wisdom
|
|