Michael Pastore wrote:
>
> Hello All,
Hello,
> Just a quick question on deleting files in Perl.
>
> I am trying to delete some files in a directory, but I do not know their
> names...just ending extension...
>
> I have tried:
>
> One way:
>
> unlink <*.dat>;
> unlink <*.p1>;
>
> Another way:
>
> unlink glob(".dat");
> unlink glob(".p1");
Both of those methods should work as long as you have permissions to
unlink those files. A more robust method would be:
unlink $_ or warn "Cannot unlink $_: $!" for <*.dat>;
John
--
use Perl;
program
fulfillment
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]