getc argument list context is broken #15708
Created by @mauke
$ perl -wE 'say prototype "CORE::getc"'
getc claims to take a single (optional) scalar argument.
$ perl -wE 'sub foo (;*); foo("a", "b", "c")'
This is what happens when you use the same prototype on a sub.
$ perl -wE 'say getc("a", "b", "c")'
This is what happens when you try it with getc: Instead of erroring out (too
$ perl -MO=Deparse -e 'getc(())'
... unless the argument is (). Instead of evaluating it in scalar context (and
This is especially weird because getc is supposed to default to STDIN, not
On Sat, 12 Nov 2016 15:30:25 GMT, mauke- wrote:
Is this problem similar to that reported by sprout in https://rt-archive.perl.org/perl5/Ticket/Display.html?id=93992?
Yes. It is in fact equivalent to what you get with foo(("a","b","c")).