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

Re: [MacPerl] Unique File Name




Hello, original poster here. Thanks for the help everyone! Here's what I
came up with. Not sure how clean or elegant it is, but it seems to work...
variations are welcome!

sub checkfordupe ()
{
  $checkfor = @_[0];
  $n = 1;
  $checkfile = "$checkfor\_$n.html";
   while (-e $checkfile) 
     {
     $n++;
     $checkfile = "$checkfor\_$n.html";
     }
  $result = "$checkfor\_$n.html";
  return $result;
}

print (&checkfordupe ("Mac HD:Web Pages:07131998"));


Pete

***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch