At 1:12 AM +0100 11/10/04, [EMAIL PROTECTED] wrote:
>Subject pretty much says it: what is the canonical way to purge a file from 
>perl?  system("purge $file"); seems rather ugly and inefficient.  
>Couldn't find anything about this in $ perldoc perlvms.

I don't know of any built-in construct to delete all but the highest version, 
if that's what you mean.

You could roll your own pretty easily.  Something like this:

sub purge_file ($) {
  my $fspec = @_[0];

  my $highest = VMS::Filespec::rmsexpand($fspec, ';0')
  $fspec =~ s/;.*\z//;
  my $lowest = VMS::Filespec::rmsexpand($fspec, ';-0')

  while ($highest ne $lowest) {
    unlink $lowest;
    $lowest = VMS::Filespec::rmsexpand($fspec, ';-0')
  }
}


Haven't actually tested that but I'll leave some of the fun to others.

-- 
________________________________________
Craig A. Berry
mailto:[EMAIL PROTECTED]

"... getting out of a sonnet is much more
 difficult than getting in."
                 Brad Leithauser

Reply via email to