Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

Re: create file with current date for name

by dvergin (Monsignor)
on Aug 07, 2001 at 20:11 UTC ( #102834=note: print w/replies, xml ) Need Help??

in reply to create file with current date for name

In your second attempt you should use 'sprintf'.

As it is, you are setting $ymd to the value returned from actually printing (using printf). So printf actually prints the desired value. Then '1' (success) is assigned to $ymd. Then that '1' is printed by the line: print "$ymd";

This also explains the result of '1.summary' in your final trace print.

If you say

  my $ymd = sprintf("%04d%02d%02d",$year+1900,$mon+1,$mday);

you should be fine.

  • Comment on Re: create file with current date for name

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (4)
As of 2022-01-20 23:48 GMT
Find Nodes?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:

    Results (57 votes). Check out past polls.