Beefy Boxes and Bandwidth Generously Provided by pair Networks Frank
more useful options
 
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 ( #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! :-)


Comment on Re: How do I remove newline character from a number got from unix command
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (11)
As of 2014-04-18 16:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (470 votes), past polls