Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re^3: How do I remove newline character from a number got from unix command

by Tux (Monsignor)
on Sep 04, 2013 at 12:37 UTC ( #1052326=note: print w/ replies, xml ) Need Help??


in reply to Re^2: How do I remove newline character from a number got from unix command
in thread How do I remove newline character from a number got from unix command

my $date_as_YYYY_MM_DD = do { my @d = localtime; sprintf "%04d-%02d-%02d", $d[5] + 1900, ++$d[4], $d[3]; };

but that is most likely better done with POSIX' strftime:

use POSIX qw( strftime ); my $d_YMD = POSIX::strftime ("%Y-%m-%d", localtime); my $d_Md = POSIX::strftime ("%d %b", localtime); # I prefer 04 Sep ov +er Sep 04

Enjoy, Have FUN! H.Merijn


Comment on Re^3: How do I remove newline character from a number got from unix command
Select or Download Code
Re^4: How do I remove newline character from a number got from unix command
by tousifp (Novice) on Sep 04, 2013 at 15:45 UTC
    t a n k s!

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1052326]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (8)
As of 2015-07-03 22:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (57 votes), past polls