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 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, and the in-place suggests a delusory "economy" where there really is none in the processing itself.. Here, with the encapsulation within a small block, the immediacy of the assignment of @ARGV relative to its use in feeding the diamond, and the overall brevity of the code, it makes good sense and makes the process more clear by abstracting the [in this case] irrelevant details of file access. Thanks, Joseph -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]