[boulder.pm] break a while(<F>) and better grep?

Robert L. Harris Robert.L.Harris at rnd-consulting.com
Sat May 13 23:51:02 CDT 2000



Currently I have a script that walks a bunch of directories.  It opens
each file and reads it with a:

while(<File>) {
  if (<$String>) {
    do stuff;
  }
}
  

Part of the problem is I want it to break out of the while at the first
time it finds $string, but not the loop that the while is in.  Will
a "break" do this clean?  Something else? 

Is there a faster way to grep a string out of a file, without actually
doing a system('grep')?  I just need to know if the string is in the
file.

Robert


:wq!
---------------------------------------------------------------------------
Robert L. Harris                |  Microso~1 :  
Senior System Engineer          |    For when quality, reliability 
  at RnD Consulting             |      and security just aren't
                                \_       that important!
DISCLAIMER:
      These are MY OPINIONS ALONE.  I speak for no-one else.
FYI:
 perl -e 'print $i=pack(c5,(41*2),sqrt(7056),(unpack(c,H)-2),oct(115),10);'




More information about the Boulder-pm mailing list