The script is looking at a source file and then outputing to produce new formatted file. When exporting it is creating the file with the name but not the content in it.

The first sentence is obvious, and the second sentence repeats the fact that you stated in the title of your original post. You still are not telling us what the script should do. Should it copy all lines from input to output? Only some of them? Should it manipulate the lines in some way?

The code itself would benefit greatly from adding use warnings;, and, as toolic already suggested to you, running your script with warnings enabled would tell you what is wrong with it.

In addition, the script you posted relies very heavily on the implicit variables,  $_ and  @_. Both those variables are very useful, but require some understanding. Take a look at a good explanation of their usage in the Modern Perl book.

Take a good look at the split(/,/); line. It should split the line from the input file into separate fields. Are you sure you understand how it works here? Have you tried looking at the documentation for split? Usually, it's used like this:

my @values = split(',', $data);

Think about split usage in your script. You do not specify the $data variable. What is being split? You do not specify the @values variable. Where do the split values go? And probably the most important question: are you sure that is where the split values go?

- Luke


In reply to Re^3: Perl Monks, Newbie to perl, running this script below is not outputing any data, plforecast.txt is 0 bytes, any help will be great by blindluke
in thread Perl Monks, Newbie to perl, running this script below is not outputing any data, plforecast.txt is 0 bytes, any help will be great by perlnobie

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.