breaking the loop

2003-09-16 Thread Johnson, Shaunn
Howdy: I'm trying to find the best solution for breaking out of a loop when editing a list of files. I have a script that: * gets a list of files * opens the files with a 'foreach $f(@list)' * does a 'while <> { ... } close (FILE)' The script works, but if I run it, it loops continually and ed

Re: breaking the loop

2003-09-27 Thread R. Joseph Newton
Jeff 'japhy' Pinyan wrote: > You can do this without opendir(), and without grep() or the for loop. > > { > local $^I = ".bak"; > local @ARGV = glob "$directory/*.txt"; > while (<>) { > s/foo/bar/g; > print; > } > } > > Ta da! > Score one for Japhy! This is the fi

Re: breaking the loop

2003-09-27 Thread James Edward Gray II
On Saturday, September 27, 2003, at 01:57 PM, R. Joseph Newton wrote: This is the first time I have seen the diamond or in-place editing operator used well. Usually I blanch when I see them--the diamond conjures up the image of some poor shmuck typing in lists of filenames at the command-line

RE: breaking the loop

2003-09-16 Thread Paul Kraus
Perldoc -f last Perldoc -f next -Original Message- From: Johnson, Shaunn [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 16, 2003 4:22 PM To: perl beginners Subject: breaking the loop Howdy: I'm trying to find the best solution for breaking out of a loop when editing a li

Re: breaking the loop

2003-09-16 Thread Jeff 'japhy' Pinyan
On Sep 16, Johnson, Shaunn said: >* gets a list of files >* opens the files with a 'foreach $f(@list)' >* does a 'while <> { ... } close (FILE)' > >The script works, but if I run it, it loops >continually and edits (then re-edits) the files. >I think I could use a lock file to do until I >get a pa

Re: breaking the loop

2003-09-16 Thread John W. Krahn
Shaunn Johnson wrote: > > Howdy: Hello, > I'm trying to find the best solution for breaking > out of a loop when editing a list of files. > > I have a script that: > > * gets a list of files > * opens the files with a 'foreach $f(@list)' > * does a 'while <> { ... } close (FILE)' > > The scri