in reply to Re: Re: file::spec and catfile?
in thread file::spec and catfile?
You have a few problems other than the newlines: for one thing, you put quotes around your variables, interpolating them into strings (why do people do this?). This will make your @arr into a space-separated string, which is not what you want. And you're not processing each of your files separately through catfile.use strict; use File::Spec; print "File Name?\n"; my $ToBeDeleted = <STDIN>; chomp $ToBeDeleted; open(IN, $ToBeDeleted) or die " The file $TheFileToBeDeleted .....Miss +ing In Action.\n"; my @arr = <IN>; chomp @arr; print "Directory where files are located?\n"; my $Path = <STDIN>; chomp $Path; foreach my $file (@arr) { my $x=File::Spec->catfile($Path, $file); unlink $x; }
|
|---|