First, try a simple regex or
index to see if the line could be what you want. Skip the rest if it isn't.
Then, try a more complex (but not as complex as the one you already use) regex to see if you were right. If not, it's not too late to skip.
Then, try to parse the data (
split it), and validate it to check if the previous checks were right.
If more lines are valid, use less checks, if less lines are valid, use more checks. It's all about knowing your data. (If all lines are valid, use no checks :)
while (<>) {
next unless /first check/;
next unless /second one/;
my @foo = split /delimiter/;
next if @foo != 5; # or whatever
...
}
<p><font color=green><code>
2;0 juerd@ouranos:~$ perl -e'undef christmas'
Segmentation fault
2;139 juerd@ouranos:~$