> From: Adam Sampson [mailto:azz@josstix.demon.co.uk] > Sent: Monday, July 12, 1999 15:59 > To: fwp@technofile.org > Subject: Re: [FWP] Puzzle - Temp file creation > > On Mon, Jul 12, 1999 at 02:02:00PM -0700, Vicki Brown wrote: > > This has the outward appearance of attempting to make a temporary file > > > > What is wrong with this code? > > # find a suitable temporary name > > $target = "$TMPDIR/quickblast${$}aaaa"; > > my $tries = 100; > > while (--$tries) { > > last if IO::File->new($target,O_WRONLY|O_EXCL|O_CREAT,0600); > > $target++; > > } > > First, it's ridiculous. What about > > $target=`mktemp $TMPDIR/quickblast.XXXXXX`; > > (I'm assuming there isn't a Perl module already to do this, which there > probably is.) POSIX::mktemp Second, since when has "aaaa"++ been "aaab"? Never, because one can't increment a constant. :-) > > azz@cartman$ perl > $a = "aaaa"; print $a; print $a++; > aaaaaaaa What happened when you tried PRE-incrementing $aa before printing it the second time? -- Larry Rosler Hewlett-Packard Laboratories http://www.hpl.hp.com/personal/Larry_Rosler/ lr@hpl.hp.com ==== Want to unsubscribe from Fun With Perl? Well, if you insist... ==== Send email to <fwp-request@technofile.org> with message _body_ ==== unsubscribe