thought about foreach? foreach my $file ("myfile.txt", "myfile2.txt"){ open(FH, $file); while(<FH>){ push @lines, $_ } close(FH); }
> -----Original Message----- > From: patrick hall [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, April 03, 2002 11:27 AM > To: [EMAIL PROTECTED] > Subject: getting several files into a single array > > > Hi, > > I've written a script with a run-of-the-mill open in > it, like this: > > $file = "myfile.txt"; > open(FH, $file); > @lines = <FH>; > close(FH); > > Now I'd like to modify it to open several files, > namely, ($myfile1, $myfile2, $myfile3) and store those > into @lines. > > I've tried using glob, but I can only get the file > _names_ into the array, not contents. I guess I could > just write three separate opens [i.e., open(FH1, > "file1.txt") and so on] and then put each into an > array, then push those onto @lines, but it seems like > there should be an easier way. > > thanks, > Pat > ~~~ > fieldmethods.net: NLP and stuff like that. > > > > > __________________________________________________ > Do You Yahoo!? > Yahoo! Tax Center - online filing with TurboTax > http://taxes.yahoo.com/ > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > ---------------------------------------------------------------------------- -------------------- The views and opinions expressed in this email message are the sender's own, and do not necessarily represent the views and opinions of Summit Systems Inc. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]