in reply to what gives?
That prints "0". The first bareword argument to print is being treated as an output file symbol. Is this meant to be an obfuscated/trick question? I don't see why anyone would write this code otherwise.perl -e 'print STDOUT x x x + x x x;'
Update:I dumped the code as follows,
I believe the parse is saying: 'Print to file handle "x" the value of global symbol "x" (null) repeated the number of times given by the expression (the value of global symbol "x" (null) repeated "x" (null) times)'.> perl -MO=Concise -e 'print x x x + x x x;' c <@> leave[t1] vKP/REFC ->(end) 1 <0> enter ->2 2 <;> nextstate(main 1 -e:1) v ->3 b <@> print vKS ->c 3 <0> pushmark s ->4 5 <1> rv2gv sKR/1 ->6 4 <#> gv s ->5 a <2> repeat[t2] sK/2 ->b 8 <2> repeat[t1] sK/2 ->9 6 <$> const(SPECIAL Null)[t4] s/BARE ->7 7 <$> const(SPECIAL Null)[t5] s/BARE ->8 9 <$> const(SPECIAL Null)[t6] s/BARE ->a -e syntax OK
Update 2: Interestingly, the following prints "xxx":
Where is the string value "x" coming from? A bareword symbol must stringify to its own name.perl -e 'print STDOUT x x + 3;'
|
|---|