Leon wrote: > > First I would like to Thank ALL the Members for the help ! > Secondly I would like to Thank those that urge me to use "use strict" & > "my". > > Unfortunately I think a lot of members have misunderstood my earlier-first > question. > My question is:- what must I do so that the output layout would look like > this :- > > Your search for HEllo returns 2 records. > hello > hello > > ### Given the following ##### > @array = qw ( hello world hello how are you ); > $match = 'HEllo'; > ####################### > > --- and this is what I've done but not to my satisfaction ------ > --- because the foreach-loop run twice and I was thinking -- > --- is there a way to come out with a better subroutine so -- > -- that I need not have to overwork the server to run double > time ------------ > > [snip code]
#!d:\perl\bin\perl.exe -w use strict; my @array = qw ( hello world hello how are you ); my $match = 'HEllo'; my @found = "@array" =~ /\b\Q$match\E\b/ig; print "Your search for $match returns ", scalar @found, " records.<br>\n"; print "$_\n" for @found; John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]