in reply to unlinking multiple files at once
Indirectly, yes. unlink can take a list, so just supply it with the result of a glob (careful since unlink with no arguments unlinks $_):
Update: I thought that unlink with an empty list would act the same as unlink with no arguments, but I was wrong, so boo_radley's answer is perfectly ok, except for the lack of error checking, if you care about such things :)my @files = <*.tmp>; if (@files) { unlink @files or warn "Problem unlinking @files: $!"; } else { warn "No files to unlink!\n"; } # Or unlink or warn "Problem unlinking $_" for <*.tmp>;
|
|---|