Yeah, my guess is that open is looking at the the 'my' stuff in list context, that is, open takes 1, 2, 3 or more arguments and you can put an array var in the first position - so my is warning you that you've got an un-paren-ed list of vars because open's trying to get it to handle the rest of the list. "my" is a uni-valued function (so you need parens/list for multiple values). If you use the 3 element form (your example has the var names backwards or, misleading, anway) though:
open my $filehandle, ">", $file
or add the 'or die ... ' test
open my $filehandle, $file or die "can't open $file: $!";
(both recommended best practices for "open") you don't get the complaint. Yeah, not really the clear-cut answer you were looking for though ... hmm, may just be a parser corner case:
$ perl -e 'use warnings; use strict; my $filename = "/tmp/hey"; open m +y $file, $filename' $ perl -e 'use warnings; use strict; my $filename = "/tmp/hey"; open m +y $file, $filename;' Parentheses missing around "my" list at -e line 1.
only diff is the final semicolon before the close quote

a


In reply to Re: Parentheses missing around "my" list by a
in thread Parentheses missing around "my" list by rastoboy

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.