in reply to Changing directories
use File::Basename qw(dirname); my $script_dir = dirname($0); my $path = "$script_dir/Pandoras Box/$file.txt"; ...
Original response:
The current working directory can always be referred to as . (a single dot), so there is no need to call the cwd command. It appears that you are just trying to do this:
Note that the append mode designator '>>' comes before the path name (preferably as a separate argument), and I can't think of why you would need double forward slashes.chomp(my $file =uc(<STDIN>)); my $path = "./Pandoras Box/$file.txt"; open FILE, '>>', $path or die "unable to append to $path: $!"; ...
Indeed, in this case specifing the current working directory with . is not even necessary:
my $path = "Pandoras Box/$file.txt"; ...
|
|---|