Interesting...

$ perl -wMstrict -e 'my $x = "a\n"; $x = chomp $x; print "<$x>\n"' <0> $ perl -wMstrict -e 'our $x = "a\n"; $x = chomp $x; print "<$x>\n"' <1> $ perl -wMstrict -MO=Terse -e 'our $x; $x = chomp $x;' LISTOP (0x8aa33b8) leave [1] OP (0x8aa3694) enter COP (0x8aa33dc) nextstate UNOP (0x8aa3414) null [15] SVOP (0x8aa3434) gvsv GV (0x8a9e5c0) *x COP (0x8aa36b8) nextstate BINOP (0x8aa36f0) sassign UNOP (0x8aa3714) schomp [2] UNOP (0x8aa3750) null [149] UNOP (0x8aa3774) null [15] SVOP (0x8aa3794) gvsv GV (0x8a9e5c0) *x UNOP (0x8aa3368) null [15] SVOP (0x8aa3398) gvsv GV (0x8a9e5c0) *x $ perl -wMstrict -MO=Terse -e 'my $x; $x = chomp $x;' LISTOP (0x92913d8) leave [1] OP (0x9291754) enter COP (0x92913fc) nextstate OP (0x9291434) padsv [1] COP (0x929171c) nextstate UNOP (0x9291778) schomp [1] UNOP (0x9291368) null [149] OP (0x92913a0) padsv [1]

In reply to Re^2: Assigning the result of a chomp to the chomped var itself. by Anonymous Monk
in thread Assigning the result of a chomp to the chomped var itself. by choroba

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.