in reply to Cannot open a file using a relative path
Don't assuming your work directory is set to the directory which contains your script. Putting the following at the top of your script should solve the issue.
use File::Basename qw( dirname ); BEGIN { # Set working directory to the one in which the script resides. chdir(dirname($0)); }
By the way, the above is more reliable than FindBin.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Cannot open a file using a relative path
by Nik (Initiate) on Apr 24, 2007 at 21:38 UTC | |
by ikegami (Patriarch) on Apr 24, 2007 at 21:48 UTC | |
by Nik (Initiate) on Apr 24, 2007 at 22:13 UTC | |
by ikegami (Patriarch) on Apr 24, 2007 at 22:29 UTC | |
by Nik (Initiate) on Apr 24, 2007 at 22:50 UTC | |
|