Neither, looks like undefined behaviour if you ask me :) JOKING

Yup, looks like a bug if you ask me

$ perl -e " $a{0} ||= scalar keys %a; print $a{0} " 1 $ perl -e " $a{0} += scalar keys %a; print $a{0} " 1 $ perl -e " $a{0} = $a{0}+ scalar keys %a; print $a{0} " 0 $ perl -e " $a{0} = $a{0} || scalar keys %a; print $a{0} " 0
$ perl -MO=Concise -e " $a{0} ||= scalar keys %a; print $a{0} " j <@> leave[1 ref] vKP/REFC ->(end) 1 <0> enter ->2 2 <;> nextstate(main 1 -e:1) v:{ ->3 - <1> null vK/1 ->c 7 <|> orassign(other->8) vK/1 ->c 6 <2> helem sKRM/2 ->7 4 <1> rv2hv sKR/1 ->5 3 <#> gv[*a] s ->4 5 <$> const[PV "0"] s ->6 b <1> sassign sK/BKWARD,1 ->c - <1> scalar sK/1 ->b a <1> keys[t4] sK/1 ->b 9 <1> rv2hv[t3] lKRM/1 ->a 8 <#> gv[*a] s ->9 c <;> nextstate(main 1 -e:1) v:{ ->d i <@> print vK ->j d <0> pushmark s ->e h <2> helem sK/2 ->i f <1> rv2hv sKR/1 ->g e <#> gv[*a] s ->f g <$> const[PV "0"] s ->h -e syntax OK
$ perl -MO=Concise -e " $a{0} = $a{0} || scalar keys %a; print $a{0} " n <@> leave[1 ref] vKP/REFC ->(end) 1 <0> enter ->2 2 <;> nextstate(main 1 -e:1) v:{ ->3 f <2> sassign vKS/2 ->g - <1> null sK/1 ->b 7 <|> or(other->8) sK/1 ->b 6 <2> helem sK/2 ->7 4 <1> rv2hv sKR/1 ->5 3 <#> gv[*a] s ->4 5 <$> const[PV "0"] s ->6 - <1> scalar sK/1 ->- a <1> keys[t5] sK/1 ->b 9 <1> rv2hv[t4] lKRM/1 ->a 8 <#> gv[*a] s ->9 e <2> helem sKRM*/2 ->f c <1> rv2hv sKR/1 ->d b <#> gv[*a] s ->c d <$> const[PV "0"] s ->e g <;> nextstate(main 1 -e:1) v:{ ->h m <@> print vK ->n h <0> pushmark s ->i l <2> helem sK/2 ->m j <1> rv2hv sKR/1 ->k i <#> gv[*a] s ->j k <$> const[PV "0"] s ->l -e syntax OK

In reply to Re: Without trying; what do you think this would print? by Anonymous Monk
in thread Without trying; what do you think this would print? by lkundrak

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.