folks,
When executing the date command, I get something like :
Tue Nov 10 15:24:50 SAUST 2009
I am trying to store the first three outputs into variables , something like :
the day will be Tue
the month will be Nov
the day num will be 10
I am having hard time getting this right ,, here what I have been trying :
my $todayDate = system qq(date);
($day, $month, $dayNum, $var4, $var5) = split(" ", $todayDate);
print "the day will be $day\n";
print "the month will be $month\n";
print "the day num will be $dayNum\n";
I get nothing printed , here is what it looks like :
the day will be
the month will be
the day num will be
Any advice plz
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.