[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [FWP] Puzzle - Temp file creation



On 14 Jul 99, at 11:49, Chaim Frenkel wrote:

> >>>>> "BC" == Bernie Cosell <bernie@rev.net> writes:
> 
> BC> [bernie@mercury script]$ perl -e '$a = "zzzz"; $a++ ; print $a, "\n" '
> BC> aaaaa
> 
> BC> and so it isn't clear it *can* fail... it might loop forever...
> 
> Loop forever?
> 
> length("zzzz") == 4	length("aaaaa") == 5
> 
> perl -wle '$a="z"; print ++$a'
> aa

Right, but if you were using that to find an unused suffix for a temp 
file, if all half-million four-letter suffixes were used, you'd step to 
'aaaaa' and your program would continue to flog the poor OS, and if all 
12-million or so filenames with _five_ chars were in use [which means 
that that directory now is know to have 12.5 million files in it! :o)] 
you'd just index from 'zzzzz' to 'aaaaaa' and I don't even want to THINK 
about what it'd take before your 'find a free file name' loop would get 
up to 'zzzzzz'...:o)

  /Bernie\
-- 
Bernie Cosell                     Fantasy Farm Fibers
mailto:bernie@fantasyfarm.com     Pearisburg, VA
    -->  Too many people, too few sheep  <--          

==== Want to unsubscribe from Fun With Perl?  Well, if you insist...
==== Send email to <fwp-request@technofile.org> with message _body_
====   unsubscribe