Hello
I am a very new to PERL. When I run the program why is it that $new_date is printed on three lines rather than one? Below is the output I get from the code further below. Thank you for any help.

-Charles
the year is 2004 the month is 03 the day is 04 2004 03 04 2004 03 03 #!/usr/bin/perl my $yr = `date -u +%Y`; #get the output of year my $mm = `date -u +%m`; #get the output of month my $dd = `date -u +%d`; #get the output of day my $yyyymmdd = `date -u +%Y%m%d`; print "the year is $yr"; print "the month is $mm"; print "the day is $dd"; $new_date = "$yr$mm$dd"; print $new_date; $yes_dd = $dd -1; $yes_dd = 0 . $yes_dd; $yes_date = $yr.$mm.$yes_dd; print "$yes_date\n";
Edit by dws to add <code> tags

In reply to simple question by pietyc

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.