Leon wrote: > > [snip kuddos] > > Co-incidentally, before I received the final solution, last night as I was > in the bed pondering about the problem, suddenly I got the solution as I > toyed upon what Andrea Holstein & Charles K. Clarkson constant reminder (in > the previous msg; long time ago ) says about the grep function. I then take > a quick look on the grep syntax & my solution is as follows, which is very > much similar to the final solution given by Members :- > > #!d:\perl\bin\perl.exe -w > use CGI::Carp qw(fatalsToBrowser); > use strict; > > print "content-type: text/html\n\n"; > @array = qw ( hello world hello how are you ); > my (@array , @filtered, $match ); > > $match = 'HEllo'; > @filtered = grep /$match/i, @array;
You might have a problem with this if there are any characters in $match that are special to regular expressions or $match is a sub-set of the array element so use either: my @filtered = grep /^\Q$match$/i, @array; Or: my @filtered = grep $_ eq $match, @array; > print "Your search for $match returns ", scalar @filtered," records.<br>\n"; > print (join '<br>', @filtered); John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]