Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

Re: Opening files

by plaid (Chaplain)
on Jul 27, 2000 at 21:46 UTC ( #24715=note: print w/replies, xml ) Need Help??

in reply to Opening files

You have to include the path to the file, either relative to where you are, or an absolute path, unless the file is in the same current directory as you are. Your current directory is wherever you were when you ran the script, if you're running from the command line. If you're running from a webserver, your current directory is the directory where the script is. You can affect the directory with the chdir function.

For example, if you are in the directory /home/you and you want to open file.txt in the directory /home/me, you could open the file in 3 different ways:

open(FILE, "/home/me/file.txt") or die "$!"; #absolute path open(FILE, "../me/file.txt") or die "$!"; #relative path chdir("../me") or die "$!"; open(FILE, "file.txt") or die "$!"; #current dir

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://24715]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (2)
As of 2022-01-19 03:37 GMT
Find Nodes?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:

    Results (55 votes). Check out past polls.