in reply to Re: Re: Re: Re: Help with null string behavior in regex?
in thread Help with null string behavior in regex?
Oh ok. This is easy enough.
@foo = grep length(), @foo; # is equivalent to but faster and clearer than my @tmp; for my $element_of_foo ( @foo ) { if ( length( $element_of_foo ) > 0 ) { push @tmp, $element_of_foo; } } @foo = @tmp;
The line @foo = map qr/$_/, @foo; could be omitted from your program with no effect except of being slower. You'll see notes on qr// in perlop. The entire point is to pre-compile each regular expression so that when you do tests against it later perl won't have to do everything on the fly (and everytime you test a new file).
|
|---|