your first fragment should work. try passing a "|| die $!" at the end of the open call, to make sure you have read permissions on it if it keeps failing. try something like this much cleaner):
die $! unless open F,"test.txt"; print reverse <F>; close F;
printing <PASSWD> in the second example won't work--in this syntax you are printing $_ to the filehandle PASSWD (which you opened read only). if you are running with warnings turned on ($^W != 0 or perl -w) you will get a runtime warning (compile time warning in 5.6). You are using strict and -w right?
the bigger questions, of course, are why are you printing the contents of the password file to an HTML page? and are you print the content type as required for cgi scripts?
darren
In reply to Re: file access
by dlc
in thread file access
by kingboa
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |