Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
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?
[LanX]: CB sidebar auto-expansion problem
[Eily]: "tail: warning: following standard input indefinitely is ineffective". I can't help but feel that tail is judging me...
[Your Mother]: Someone had to say it. Better it came from tail.
[LanX]: Cat Mama!
[Your Mother]: Das right.
[Eily]: actually I forgot to provide the filename as a parameter
LanX it reeks.
[Your Mother]: You know what they say, the reeky wheel gets the best price at cheese market.
[Eily]: well I had to google translate that
[Eily]: let me inform you that the Dutch reek translate into the Czech páchnout

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (8)
As of 2017-03-27 16:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should Pluto Get Its Planethood Back?



    Results (320 votes). Check out past polls.