Dear brethren, I had the good fortune yesterday to spot an unanswered Seeker query to which I knew the answer. As I wrote my reply, I strove to be helpful, correct, but above all quick.

There are details I might have done differently. The querent said

'>C:\Program Files\cron\Cruise Ships\ship_data.csv'
and when I converted to three-arg open I could have left the filename at
'C:\Program Files\cron\Cruise Ships\ship_data.csv'
or converted to
'C:/Program Files/cron/Cruise Ships/ship_data.csv'
because (as all Windows Perl programmers should be told) forward slashes work just fine for telling Windows where to go, and can never be mistakenly parsed as escapes, and I'd rather not spend any time at all thinking about when a backslash is an escape and when it isn't.

I could also have changed $output to $output_fh and $input to $input_data, but chose instead to retain the querent's own variable names.

Others would certainly have made different choices. I'm still surprised that the particular nit that was picked was the pair of braces around the filehandle in

print {$output} $input;

In reply to Re^3: File open problem with "GLOB" by Narveson
in thread File open problem with "GLOB" by mcoblentz

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.