I need to check whether a file in a user's home directory exists so use file check:
if ( -e "~/foo.txt" ) {
print "yes, it exists!" ;
}
Even though there is a file called foo.txt under the user's home directory, Perl always complains that there is no such file or directory. When I replace "~" with /home/jimmy (let's say the user is jimmy) then Perl give the right verdict.
Could you explain why "~" dosen't work in Perl and tell me what is Perl's way to find a user's home directory?