monkfan has asked for the wisdom of the Perl Monks concerning the following question:
Both of the approaches I tried failed to delete the files. I also tried to delete files outside subroutines also failed. Is there a correct way to do it? Or any better alternatives?#!/usr/bin/perl -w use strict; use File::Remove; use Shell; my $some_value = the_subrotine(@array); sub the_subroutine { my @array = @_; # then execute code that returns a value # plus some temporary files in ~/tmp/ return $somevalue; # I need to remove these files, so this is what I did # with method from Shell module - failed find ("~/tmp/ -maxdepth 1 -type f -exec rm -v {} \;"); # With method from File::Remove - also failed # remove (~/tmp/ *~); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Removing Files from non-pwd with Shell and File::Remove
by jbrugger (Parson) on Apr 22, 2005 at 05:41 UTC | |
|
Re: Removing Files from non-pwd with Shell and File::Remove
by eXile (Priest) on Apr 22, 2005 at 05:09 UTC | |
|
Re: Removing Files from non-pwd with Shell and File::Remove
by splinky (Hermit) on Apr 22, 2005 at 12:56 UTC |