http://www.perlmonks.org?node_id=786253


in reply to Re: Huge simple problem
in thread Huge simple problem

May I suggest that you learn to use the foreach loop in Perl, rather than the c-style for loop.

Do note that foreach is just an alternate spelling of for. for my $text (@searchtexts) { ... } is exactly equivalent to foreach my $text (@searchtexts) { ... }.

Either way, though, I can't remember the last time I used a C-style for loop in Perl. for ( [list] ) is so much nicer and avoids all those nasty off-by-one errors.