G'day hahazeeq,

Welcome to the Monastery.

"From this I am getting nothing."

You've added checks throughout for failed I/O - this is good. If files weren't created, you would have received messages from these checks. Not posting these is less good: we can't see what went wrong.

The first problem that leaps out at me is @output.

This should probably be a scalar, not an array. A lexical variable (my) would probably be better than an alias to a package variable (our).

Then later in the code

@output = $timestamp .'.sql'; open(my $fh, '>', @output) or die "Could not create file '@output': $! +";

becomes

$output = $timestamp .'.sql'; open(my $fh, '>', $output) or die "Could not create file '$output': $! +";

There's also potential problems with

open(my $fn, '<', $filename) ...

which possibly needs to be

open(my $fn, '<', "$directory/$filename") ...

Add temporary print statements to your code to perform your own troubleshooting. Check if you're reading and writing to the correct pathname, as opposed to the correct filename.

Without seeing your error messages, I'm really just guessing at problems. If you need further assistance, please see these guidelines for what to post such that we can help you most effectively.

-- Ken


In reply to Re: Opening multiple log files by kcott
in thread Opening multiple log files by hahazeeq

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.