Solved. It is a wrong .bashrc file that gives an alias adding the -l switch...

In perl v5.10, as pre-installed on my Ubuntu 64bit 10.04 LTS OS, the 'print' function does not append "\n" after it automatically (which is the right behavior). So the following command:

$ /usr/bin/perl -e 'print 123; print 456'       # v5.10

will print:

123456                                          # no NL appended

But in perl v5.14 in my own folder, 'print' behaves exactly the same as 'say', i.e. it prints a "\n" after it every time:

$ perl -e 'print 123; print 456'                # v5.14

gives the output:

123 # NL appended 456

http://www.perl.com/pub/2008/04/23/a-beginners-introduction-to-perl-510.html

The website says that the only difference between 'print' and 'say' is that 'say' appends NL after the string list while 'print' does not.

Is this a bug behavior of 'print' in perl v5.14 then?


In reply to For the 'print' function in perl v5.14 by Diamondust

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.