cpomp has asked for the wisdom of the Perl Monks concerning the following question:
As you can see the solution that have goes through each element of the array for every line. I though about using a hash but it didn't work because it isn't an exact match so I have to run a regExp to see if the line contains any of the lines of the skip arr. How can I improve on this. Thanks!# $line is the current line # @bypList is the array containing all lines in the skip file sub check_bypass { my $line= shift; my @bypList= @_; my $ret= 1; foreach(@bypList) { if($line=~/$_/i) { $ret= 0; } } return $ret; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Fast/efficient way of check if a string in an strArr is contained in a line
by Limbic~Region (Chancellor) on Nov 12, 2008 at 01:00 UTC | |
|
Re: Fast/efficient way of check if a string in an strArr is contained in a line
by dragonchild (Archbishop) on Nov 12, 2008 at 01:05 UTC | |
|
Re: Fast/efficient way of check if a string in an strArr is contained in a line
by GrandFather (Saint) on Nov 12, 2008 at 01:07 UTC | |
|
Re: Fast/efficient way of check if a string in an strArr is contained in a line
by toolic (Bishop) on Nov 12, 2008 at 00:48 UTC | |
|
Re: Fast/efficient way of check if a string in an strArr is contained in a line
by betterworld (Curate) on Nov 12, 2008 at 01:16 UTC | |
|
Re: Fast/efficient way of check if a string in an strArr is contained in a line
by almut (Canon) on Nov 12, 2008 at 00:57 UTC | |
|
Re: Fast/efficient way of check if a string in an strArr is contained in a line
by gone2015 (Deacon) on Nov 12, 2008 at 01:03 UTC |