so in the previous examples given me I could do as such
is their another trick to forgo the 4 lines above the "local @ARGV" ?? foreach $file (@sleepystart) { open FILE, "$file"; $line = <FILE>; close (FILE); chomp($line); local @ARGV = @sleepystart; while (<>) { s/\Q$line\E/$db_name/g; print; } } Regards, Ron > -----Original Message----- > From: Jeff 'japhy' Pinyan [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, January 09, 2002 11:50 > To: Yacketta, Ronald > Cc: Beginners (E-mail) > Subject: Re: array of filenames to open > > > On Jan 9, Yacketta, Ronald said: > > >looking for a simple example of putting a set of filenames > into an array > >and then opening each of them for parsing. > > > >@files = ( "file1", "file2", "file3" ); > > > >foreach $file (@files) { > > open FN, "< $file"; > > do something here > > close > >} > > This is fine. You could even have variables in the array. > > @files = ($this, $that, "known.txt"); > > If you really need to treat each file separately, your code > above is fine, > but you can take advantage of a Perl trick if you can allow > the files to > be treated as one big file: > > { > local @ARGV = ($this, $that, "foo", "bar"); > while (<>) { > # $_ is a line from a file > } > } > > That will open $this, and when it's empty, it'll open $that, and then > "foo", and then "bar". > > -- > 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. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]