Don't ask to ask, just ask | |
PerlMonks |
Re^3: Finding Line numbers in a fileby Rhandom (Curate) |
on Apr 04, 2007 at 16:09 UTC ( [id://608314]=note: print w/replies, xml ) | Need Help?? |
You are possibly right. You are just as possibly wrong. There are several things that we don't know, such as:
But one thing that is a major issue is that the special regex capture variables shouldn't be used. They impose too much penalty. Instead though you can use @- and @+ which have no penalty. As in the following:
Notice the optimization that only counts newlines from the previous match.
my @a=qw(random brilliant braindead); print $a[rand(@a)];
In Section
Seekers of Perl Wisdom
|
|