in reply to Re^8: Try::Tiny and -E
in thread Try::Tiny and -E

That's because print is a very special beast which allows an unusual print FH @args syntax.

compare

~$ perl use warnings; sub shift {} shift; __END__ Ambiguous call resolved as CORE::shift(), qualify as such or use & at +- line 4. ~$

Other languages like Javascript block the use of built-ins as function names. This could be a solution for the case print and similar commands.

Cheers Rolf
(addicted to the Perl Programming Language :)
see Wikisyntax for the Monastery

Replies are listed 'Best First'.
Re^10: Try::Tiny and -E
by ikegami (Patriarch) on Dec 30, 2025 at 05:06 UTC

    But so is try.

    The difference between print and shift is that print can't be prototyped. The same goes for try since it's not even a function but a keyword like while.

    $ perl -Mv5.40 -e'say prototype "CORE::$ARGV[0]" // "[undef]"' shift ;\@ $ perl -Mv5.40 -e'say prototype "CORE::$ARGV[0]" // "[undef]"' print [undef] $ perl -Mv5.40 -e'say prototype "CORE::$ARGV[0]" // "[undef]"' try [undef]