in reply to Insert Element Into Array

Which array would you like to insert it into ?

Why ?

Wouldn't it be easier to just print "day, month, date, time, year, rdy, bsy, rd, wr, ka, log, dns, cls\n" first before processing ?

The 'unshift' function is useful in pre-pending an element to an array.

             I hope life isn't a big joke, because I don't get it.
                   -SNL

Replies are listed 'Best First'.
Re^2: Insert Element Into Array
by Anonymous Monk on Jun 21, 2012 at 15:30 UTC

    I would like to insert it in @L1 on the first line. I can't print the string because it needs to eventually be output as a CSV file. If I were to print it within the loop it would print on every other line. I still haven't found a simple solution to this. Any ideas?

      But you are re-initializing @L1 (You use my @L1) inside the "for $line" loop.

      So, anything you add at the beginning will be obliterated by the re-initialization.

      Please re-think your logic, and reconsider my suggestion to print the titles first, before entering the loop.

      It matters little that the "print" output is redirected to a CSV file.

                   I hope life isn't a big joke, because I don't get it.
                         -SNL