in reply to Re^3: Opening multiple log files
in thread Opening multiple log files

I see. Alright, I won't be using modules cause I'm still learning so I want to do more of the coding first. I understand the code you have provided would read every file in the directory which have the .log extension.

However, is there anyway anyway to get the file name as well? If you notice at the second part of my code I am trying to get the file that I have opened(which is formatted in a timestamp)to use it to print in the file I'm going to create. I'm not sure how to do that with your codes.

Replies are listed 'Best First'.
Re^5: Opening multiple log files
by kcott (Archbishop) on Jun 15, 2015 at 08:33 UTC
    "... I won't be using modules ..."

    I not certain what you're getting at here. The link to File::Glob was for documentation to read, not a module to use. The link to glob() explains this. Besides, you're already using three modules:

    use strict; use warnings; use POSIX 'strftime';
    "... is there anyway anyway to get the file name as well?"

    The filename that -f operates on? The filename that /\.log$/ is attempting match?

    -- Ken

      I see. Pardon me, I assumed anything with a :: was a module.I still do not know how to integrate it though. What I meant for the file name was I used a variable in my second part but I'm not sure how the "next unless -f and /\.log$/" has a variable that I can use for my code in the second part.

        My responses so far have assumed you wrote the original code. Your subsequent replies seem to suggest this is not the case. There is a lot of very basic code that you do not appear to understand.

        That's all fine. Before I saw any Perl code (20+ years ago), I didn't know any of this either. However, you do need a basic foundation before anything more advanced is likely to make much sense.

        I strongly recommend you read "perlintro -- a brief introduction and overview of Perl". This will explain much of the beginner concepts; and it provides links to more detailed information for topics introduced. It's not a particularly long document and I suggest you read it in full: it should bring some clarity to the advice you've been given (by myself and others) in this thread.

        -- Ken

Re^5: Opening multiple log files
by Anonymous Monk on Jun 15, 2015 at 09:14 UTC

    I see. Alright, I won't be using modules cause I'm still learning so I want to do more of the coding first.

    The most important thing you can do is start creating subroutines , your gets shorter the more you do this

    { my %details; for my $infile( @inputFiles ){ FillDetails( \%details, $infile ); } SpillDetails( \%details, $outfile ); } exit( 0 );