Hi Brad,
within the
do loop the
$tempname variable is assigned a randomly chosen value between zero and
$limit, which we can see is 99999.
$md is then assigned the value of
$TMPDIR (not listed in the code you provided) pluse the sring "/runitout_" and the value of
$tempname. This will happen until
no(the !) file exists (-f) for the value of
$md shown in
until (! -f "$md"); at the end of the
do construct. It there are any parts you dont understand check out
perldoc and the
Tutorials section of this site. Perhaps the module
File::Temp may also be of interest to you.
Comment version of your code:
my $limit = 99999;
my $md;
# Creates unique tmpfile
do { #do the following
$tmpname = int(rand($limit)); #$tmpname = convert t
+o integer random number between 0 and $limit (99999)
$md = "$TMPDIR/runitout_$tmpname"; #$md = "$TMPDIR/run
+itout_$tmpname" concatinated values of $TMPDIR (not listed) the strin
+g "/runitout_" and the value of $tmpname
} until (! -f "$md"); #until file $md does
+ not exist
Hope this helps.
Martin
Update: Fixed typo, later added a commented version of the user provided script