Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: string concatenation, which way is better?

by johngg (Abbot)
on Aug 08, 2012 at 22:09 UTC ( #986372=note: print w/replies, xml ) Need Help??


in reply to string concatenation, which way is better?

You seem to be a little inconsistent with your variable names between the two code examples, $todayDate in one and $today_date in the other, so you may have a typo in your script. I don't know how you initialise your $todayDate variable. If you generate it programmatically in your code rather than reading it from a file you may find the strftime() function of the POSIX module along with localtime and time useful.

$ perl -MPOSIX=strftime -E ' > $file_dir = q{/var/log}; > say strftime qq{$file_dir/filename1.log.%F}, localtime( time() );' /var/log/filename1.log.2012-08-08 $

I hope this is helpful.

Cheers,

JohnGG

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (4)
As of 2016-09-29 02:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Extraterrestrials haven't visited the Earth yet because:







    Results (545 votes). Check out past polls.