On Sat, 12 Nov 2016 15:30:25 GMT, mauke- wrote: > > This is a bug report for perl from l.mai@web.de, > generated with the help of perlbug 1.40 running under perl 5.24.0. > > > ----------------------------------------------------------------- > [Please describe your issue here] > > $ perl -wE 'say prototype "CORE::getc"' > ;* > > getc claims to take a single (optional) scalar argument. > > $ perl -wE 'sub foo (;*); foo("a", "b", "c")' > Too many arguments for main::foo at -e line 1, near ""c") > " > Execution of -e aborted due to compilation errors. > > This is what happens when you use the same prototype on a sub. > > $ perl -wE 'say getc("a", "b", "c")' > Useless use of a constant ("a") in void context at -e line 1. > Useless use of a constant ("b") in void context at -e line 1. > getc() on unopened filehandle at -e line 1. > Use of uninitialized value in say at -e line 1. > > > This is what happens when you try it with getc: Instead of erroring > out (too > many arguments) it treats it as a scalar comma operator, throwing all > but the > last argument away. > > $ perl -MO=Deparse -e 'getc(())' > getc ARGV; > -e syntax OK > > ... unless the argument is (). Instead of evaluating it in scalar > context (and > getting undef), it silently replaces it by ARGV. > > This is especially weird because getc is supposed to default to STDIN, > not > ARGV. > Is this problem similar to that reported by sprout in https://rt.perl.org/Ticket/Display.html?id=93992? -- James E Keenan (jkeenan@cpan.org) --- via perlbug: queue: perl5 status: new https://rt.perl.org/Ticket/Display.html?id=130078