Deleting the backup files in the directory perl
Use simply
Here i have assumed the backup files to end with .bak this wildcard can be changed as per your requirement
in the perl script and execute it will delete all the files ending up .bak in the current directory
you can also execute from the command line as follows:
G:\perl_programs>perl -e "unlink(<*.bak>);"
Please don't use . Use glob("wildcard"). Much less confusing, much easier to extend.
ReplyDelete$wildcard = "*.bak";
unlink <$wildcard>;
That doesn't work as intended. Change to glob, it does.
Thanks
ReplyDelete