CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

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

 



cmccabe1
Novice

Mar 26, 2015, 11:53 AM

Post #1 of 2 (7387 views)
unlink error trying to remove files Can't Post

Trying to remove files from a directory using:


Code
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 :).

Error:

Code
use: command not found 
my: command not found

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



FishMonger
Veteran / Moderator

Mar 26, 2015, 12:07 PM

Post #2 of 2 (7382 views)
Re: [cmccabe1] unlink error trying to remove files [In reply to] Can't Post

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.

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives