Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

Re: Command Grep

by bwana147 (Pilgrim)
on Aug 29, 2001 at 15:01 UTC ( #108731=note: print w/replies, xml ) Need Help??

in reply to Command Grep

Nice! Two comments though:

  • Since $pat doesn't ever change, you can use the /o modifier to prevent the recompilation of the regex at each loop: $name =~ /$pat/o
  • Since you use pipes as pattern delimiter, the slash looses its special meaning and no longer needs be escaped: s|//|/|g;. That's easier to read, IMHO (btw, what's the use of this?)


Replies are listed 'Best First'.
Re: Re: Command Grep
by fundflow (Chaplain) on Aug 29, 2001 at 19:58 UTC
    Updated, thanks.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://108731]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (10)
As of 2016-10-24 07:19 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (303 votes). Check out past polls.