in reply to Re^2: false warning: print (...) interpreted as function
in thread false warning: print (...) interpreted as function

If this warning sounded like: "print ([^)]*) interpreted as function" or "print (...) interpreted as function, where '...' is qr/[^)]*/" - it would be understandable. Because I don't know what do three points ('...') mean and am thinking that a warning is unnecessary.

Replies are listed 'Best First'.
Re^4: false warning: print (...) interpreted as function
by ikegami (Patriarch) on Nov 06, 2015 at 18:34 UTC

    Your suggestions are wrong.

    $ perl -wle'print ((1))' print (...) interpreted as function at -e line 1. 1

    Because I don't know what do three points ('...') mean and am thinking that a warning is unnecessary.

    Ellipses are extremely commonly used in CS as a generic placeholder.

    and am thinking that a warning is unnecessary.

    The warning was indeed spurious in this case. It's there to catch the following error:

    print (4+3)*2; # Expected to print 14, but prints 7

      Hello ikegami,

      Interestingly, this particular warning goes away if the print command is terminated by a semicolon:

      15:54 >perl -wle "print ((1))" print (...) interpreted as function at -e line 1. 1 15:54 >perl -wle "print ((1));" 1 15:54 >

      I get the same behaviour on my various Strawberry Perls, which range from 5.14.4 to 5.22.0.

      Seems to be another (strange) heuristic employed by the warnings pragma.

      Update: Changed wording of first paragraph (underlined words) to clarify that my comment applies only to cases like ikegami’s example, in which “the statement completed by the semicolon is a complete and unambiguously correct print statement” (BrowserUk, below). See also my earlier post: Re^3: false warning: print (...) interpreted as function.

      Cheers,

      Athanasius <°(((><contra mundum Iustus alius egestas vitae, eros Piratica,

        Only if the statement completed by the semicolon is a complete and unambiguously correct print statement:

        print ((1)), 1;; print (...) interpreted as function at 1

        With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
        Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
        "Science is about questioning the status quo. Questioning authority". I knew I was on the right track :)
        In the absence of evidence, opinion is indistinguishable from prejudice.
        ... the warning goes away if the print command is terminated by a semicolon ...

        Likewise ActiveState 5.8.9 and Strawberries 5.10.1.5 and 5.12.3.0.


        Give a man a fish:  <%-{-{-{-<

Re^4: false warning: print (...) interpreted as function
by hippo (Archbishop) on Nov 06, 2015 at 14:12 UTC
    I don't know what do three points ('...') mean

    It's an ellipsis.