Please do... I thought using qr// to store REs in variables speed up since it gets compiled once instead of over and over again.
> -----Original Message----- > From: Jeff 'japhy' Pinyan [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, April 16, 2002 11:50 AM > To: Nikola Janceski > Cc: '[EMAIL PROTECTED]'; Beginners (E-mail) > Subject: RE: grep a array element.. > > > On Apr 16, Nikola Janceski said: > > >Yes.... but only if you are looking for that pattern.. if > you wanted to add > >something like "sedan" then you need to use // but the qr > would speed up the > >compile when using a $var in the //; > > > >if($element =~ $lookfor) { ## works if $lookfor = qr/car/; > the same as > >$element =~ /car/ > > > >if($element =~ /sedan $lookfor/) { ## works faster if > $lookfor = qr/car/; > >than if $lookfor = "car"; > > Sadly, that's misinformation. If the group would like, I can > write a post > explaining the PURPOSE and APPLICATION of qr// in code. > After reading it, > you should have a good grasp of when qr// gives speed benefits. > > -- > Jeff "japhy" Pinyan [EMAIL PROTECTED] > http://www.pobox.com/~japhy/ > RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/ ** Look for "Regular Expressions in Perl" published by Manning, in 2002 ** <stu> what does y/// stand for? <tenderpuss> why, yansliterate of course. [ I'm looking for programming work. If you like my work, let me know. ] ---------------------------------------------------------------------------- -------------------- 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]