Home: Perl Programming Help: Beginner:
unlink error trying to remove files


Mar 26, 2015, 11:53 AM

Views: 7932
unlink error trying to remove files

Trying to remove files from a directory using:

remove() { 
printf "\n\n"
printf "Removing old files, please wait ";
use strict;
use warnings;
my $dir = "$ENV{HOME}'C:\Users\cmccabe\Desktop\annovar'";
unlink glob "$dir/out_position.txt";
unlink glob "$dir/out_parse.txt";
printf "\n Old files removed, Goodbye! \n\n"; sleep 2 && exit

but getting an error. I am using the perl command as part of a bash menu in cygwin. Thank you :).


use: command not found 
my: command not found

Unlink extra operand /out_position.txt
Unlink extra operand /out_parse.txt

Veteran / Moderator

Mar 26, 2015, 12:07 PM

Views: 7927
Re: [cmccabe1] unlink error trying to remove files

Obviously using perl code directly in a bash script isn't going to work. Bash doesn't now how to execute perl code, but it can execute a perl script.

And, why do you have a beginner level question in the intermediate section? I'm moving this thread for you.