Solved

ActiveState Perl for Win32

Posted on 1998-11-02
2
216 Views
Last Modified: 2010-03-04
Hi,
Do I have to always give the full path when I refer to an other file within my script.

If no, How?
0
Comment
Question by:martalex
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 5

Accepted Solution

by:
b2pi earned 50 total points
ID: 1205874
No, you don't.  You can use relative paths in the same way that you would in any operation.  However, if you use a relative path, you need to know what it's relative to (the current working directory), and what that might be.

If you're talking about use'ing or require'ing files, the current include path (@INC) is used.
0
 
LVL 1

Expert Comment

by:johnsm
ID: 1205875
I've found that if the file is in the same directory as the script you can use

   open (FH, "file.txt");

but if it is not then you need to use

   open (FH, "c:\whatever\file.txt");

even if c:\whatever is in your path.

I found that even though my datafile is in a directory that is in my path, if my script is not in the same directory perl will not find it.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A year or so back I was asked to have a play with MongoDB; within half an hour I had downloaded (http://www.mongodb.org/downloads),  installed and started the daemon, and had a console window open. After an hour or two of playing at the command …
There are many situations when we need to display the data in sorted order. For example: Student details by name or by rank or by total marks etc. If you are working on data driven based projects then you will use sorting techniques very frequently.…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

697 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question