develooper Front page | perl.perl5.porters | Postings from March 2006

[perl #4346] "print (...) interpreted as function", but only sometimes.

From:
Steve Peters via RT
Date:
March 21, 2006 07:18
Subject:
[perl #4346] "print (...) interpreted as function", but only sometimes.
Message ID:
rt-3.0.11-4346-131367.15.5308495003944@perl.org
> [abigail - Mon Sep 25 05:22:50 2000]:
> 
> This is a bug report for perl from abigail@foad.org,
> generated with the help of perlbug 1.28 running under perl v5.6.0.
> 
> 
> -----------------------------------------------------------------
> [Please enter your report here]
> 
> It seems that Perl issues the 'print (...) interpreted as function'
> warning depending on whether the print statement is terminated by
> a semicolon, and depending on the arguments.
> 
>    $ cat eek1.pl
>    print ("((");
>    print (">>");
>    $ perl -wl eek1.pl
>    print (...) interpreted as function at eek1.pl line 1.
>    ((
>    >>
>    $ cat eek2.pl
>    print ("((");
>    print (">>")
>    $ perl -wl eek2.pl
>    print (...) interpreted as function at eek2.pl line 1.
>    print (...) interpreted as function at eek2.pl line 2.
>    ((
>    >>
>    $ cat eek3.pl
>    print (">>");
>    print ("((");
>    $ perl -wl eek3.pl
>    print (...) interpreted as function at eek3.pl line 2.
>    >>
>    ((
>    $ cat eek4.pl
>    print (")");
>    print ("))");
>    $ perl -wl eek4.pl
>    print (...) interpreted as function at eek4.pl line 1.
>    )
>    ))
>    $
> 
> There's a warning if the print statement is not terminated by a
>    semicolon,
> or if the argument is a closing brace followed by only whitespace, or
>    starts
> with one or more opening braces. In other cases, it doesn't seem to
>    emit the
> warning. This is disturbing.
> 
> 

It looks like say(...) has picked up this problem as well.

> ./perl -Ilib -wl /tmp/eek1.pl
say (...) interpreted as function at /tmp/eek1.pl line 3.
say (...) interpreted as function at /tmp/eek1.pl line 4.
((

>>




nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About