Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

To reinforce tobyink’s answer:

Is it the windows peculiarity which I have here?

No, with

use strict; use warnings; use diagnostics;

I get identical messages under cmd.exe (perl 5, version 16, subversion 0 (v5.16.0) built for MSWin32-x86-multi-thread-64int) and Cygwin (perl, v5.10.1 (*) built for i686-cygwin-thread-multi-64int):

$ perl -c Warning: Use of "-s" without parentheses is ambiguous at l +ine 36 (#1) (S ambiguous) You wrote a unary operator followed by something tha +t looks like a binary operator that could also have been interpreted + as a term or unary operator. For instance, if you know that the rand function has a default argument of 1.0, and you write rand + 5; you may THINK you wrote the same thing as rand() + 5; but in actual fact, you got rand(+5); So put in parentheses to say what you really mean. Unterminated <> operator at line 36 (#2) (F) The lexer saw a left angle bracket in a place where it was exp +ecting a term, so it's looking for the corresponding right angle bracket, + and not finding it. Chances are you left some needed parentheses out earlier in the line, and you really meant a "less than". Uncaught exception from user code: Unterminated <> operator at line 36. at line 36
If I search for files bigger than 1000 the parentheses are not necessary.

I take it you mean:

my @selection = grep { -s > 1000 } @ARGV;

Here there is no ambiguity, since > doesn’t begin any other operator, as < does.

Update: The following excerpt from -X may also be of (tangential) interest:

These operators are exempt from the "looks like a function rule" described above. That is, an opening parenthesis after the operator does not affect how much of the following code constitutes the argument. Put the opening parentheses before the operator to separate it from code that follows (this applies only to operators with higher precedence than unary operators, of course):

-s($file) + 1024 # probably wrong; same as -s($file + 1024) (-s $file) + 1024 # correct

Hope that helps,

Athanasius <°(((><contra mundum

In reply to Re: The "<" in the grep block by Athanasius
in thread The "<" in the grep block by vagabonding electron

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, 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, 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.
  • Log In?

    What's my password?
    Create A New User
    and all is quiet...

    How do I use this? | Other CB clients
    Other Users?
    Others taking refuge in the Monastery: (5)
    As of 2018-04-20 03:48 GMT
    Find Nodes?
      Voting Booth?