Loading ...
Sorry, an error occurred while loading the content.

Opening multiple files at once....

Expand Messages
  • Steve Milo
    Hi all, I ll get to the point quickly: my @FILES = ( file1 , file2 , file3 , file4 ); ##What I would like to accomplish with ##the above is something like
    Message 1 of 3 , Dec 29, 2000
    • 0 Attachment
      Hi all, I'll get to the point quickly:

      my @FILES = ("file1", "file2", "file3", "file4");

      ##What I would like to accomplish with
      ##the above is something like this

      open (FILE, "@FILES") || die;

      ##then put the files contents into an array

      my @contents = <FILE>;

      I've come to conclusion that the only way to accomplish this is to do
      a foreach on @FILES. Then open and close until I have all the
      contents. Is there any other way to accomplish this.

      Thanks, and thanks for the help on the previous stuff,
      Steve M
    • Steve Milo
      Thanks for the help all, I m having a slight, almost insignificant problem with the suggestions. I tried them both, but I d like to keep things neat . My
      Message 2 of 3 , Jan 2, 2001
      • 0 Attachment
        Thanks for the help all,

        I'm having a slight, almost insignificant problem with the
        suggestions. I tried them both, but I'd like to keep things 'neat'.

        My filenames look something like this:

        $PATH/filenameA.logfile
        $PATH/filenameB.logfile
        $PATH/filenameA.logfile.old
        $PATH/filenameB.logfile.old

        When I tried to put them into the suggestions, I would either get some
        of the files to print. As if it was skipping a file or something. Or
        it would tell me that it couldnt open up the filename.

        Thanks again,
        Steve M
      • Steve Milo
        Nevermind, I didnt have enough comma s and quotes....... Steve M
        Message 3 of 3 , Jan 2, 2001
        • 0 Attachment
          Nevermind, I didnt have enough comma's and quotes.......

          Steve M
        Your message has been successfully submitted and would be delivered to recipients shortly.