uh... my $lookfor = qr/car/; # this is faster and you don't even need to put in the //
> -----Original Message----- > From: John Edwards [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, April 16, 2002 9:42 AM > To: '[EMAIL PROTECTED]'; [EMAIL PROTECTED] > Subject: RE: grep a array element.. > > > You mean something like this? > > --- > use strict; > > my @array = qw(car bus caravan bike cart); > > my $lookfor = "car"; > > foreach my $element (@array) { > if ($element =~ /$lookfor/) { > print "Found a match!! => $element\n"; > } else { > print "$lookfor doesn't match $element\n"; > } > } > --- > > HTH > > John > ---------------------------------------------------------------------------- -------------------- The views and opinions expressed in this email message are the sender's own, and do not necessarily represent the views and opinions of Summit Systems Inc. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]