Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

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

by space_monk (Chaplain)
on Sep 04, 2013 at 12:34 UTC ( [id://1052324]=note: print w/replies, xml ) Need Help??


in reply to How do I remove newline character from a number got from unix command

The newline is attached because you're executing an OS command to do the work. Try using something more operating system agnostic - e.g.
use POSIX qw(strftime); my $date = strftime "%Y", localtime; print $date;
or...
use DateTime qw(); DateTime->now->strftime('%Y');
If you spot any bugs in my solutions, it's because I've deliberately left them in as an exercise for the reader! :-)

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (3)
As of 2024-04-19 23:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found