I like the idea by
setebos of using
gettimeofday for high-granularity time. But I'd prefer a one-to-one mapping between timeofday and the filename, so, using the
transliteration operator 'y', along with the most common letters (but including all of the vowels, even 'y'):
use strict;
use warnings;
use Time::HiRes qw/gettimeofday/;
while (1) {
my $fname = create_filename_from_current_time();
print "Filename is '$fname'\n";
}
sub create_filename_from_current_time {
(my $fname = gettimeofday) =~ y/0-9/etaonirsuy/;
return $fname;
}
This produces output of the sort:
Filename is 'taotiaueta.retry'
Filename is 'taotiaueta.retso'
Filename is 'taotiaueta.retsu'
Filename is 'taotiaueta.retuo'
Filename is 'taotiaueta.retuu'
Filename is 'taotiaueta.retya'
Filename is 'taotiaueta.retys'
Filename is 'taotiaueta.reaea'
Filename is 'taotiaueta.reaes'
Filename is 'taotiaueta.reatt'
Filename is 'taotiaueta.reatr'
Filename is 'taotiaueta.reaat'
Filename is 'taotiaueta.reaai'
Filename is 'taotiaueta.reao'
I like that the "
extension" of the first filename in the list is coincidentally a real word!
s''(q.S:$/9=(T1';s;(..)(..);$..=substr+crypt($1,$2),2,3;eg;print$..$/
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.