Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: crypt prototype and ( time ) x 2

by Abigail-II (Bishop)
on Oct 08, 2003 at 09:49 UTC ( [id://297520]=note: print w/replies, xml ) Need Help??


in reply to crypt prototype and ( time ) x 2

Either do what Liz said, or if you really don't want to create extra variables, do something like:
$ perl -wle 'print sub {crypt $_ [0], $_ [0]} -> (time)'

Having said that, one should realize that the output only changes every 100 seconds, as crypt only looks at the first 8 characters, and time returns nowadays a 10 digit number.

Abigail

Replies are listed 'Best First'.
•Re: Re: crypt prototype and ( time ) x 2
by merlyn (Sage) on Oct 08, 2003 at 14:20 UTC
Re: Re: crypt prototype and ( time ) x 2
by DentArthurDent (Monk) on Oct 08, 2003 at 13:01 UTC
    If you wanted to get around the time only changing every 100 seconds problem use:
    $time = time() % 100000000; # time mod a number with 8 zeros
    That will give you a different time-seeded number every second, being the last 8 digits of the time returned by the time function.
    ----
    If I melt dry ice can I swim without getting wet?

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (7)
As of 2024-04-18 06:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found