in reply to Correct pathway to a file

No, they don't need to be in the same directory. Just use the full path to the file when opening it...

open my $fh, '<', '/home/tai/Documents/foo.txt'; while (my $line = <$fh>) { print "Got line: $line"; } close $fh;
perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'