my @array = ('file', 'this', 'dog', 'forward' ); my $searchstring = join '|',@array; foreach ( @file ) { if ( /($searchstring)/i ) { push @stringsfound,$1 unless grep { $_ eq $1 } @stringsfound; } }
In reply to Re: Match a string only once in a file
by hsinclai
in thread Match a string only once in a file
by newbie2perl
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |