Solved

ActiveState Perl for Win32

Posted on 1998-11-02
2
204 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
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

I have been pestered over the years to produce and distribute regular data extracts, and often the request have explicitly requested the data be emailed as an Excel attachement; specifically Excel, as it appears: CSV files confuse (no Red or Green h…
In the distant past (last year) I hacked together a little toy that would allow a couple of Manager types to query, preview, and extract data from a number of MongoDB instances, to their tool of choice: Excel (http://dilbert.com/strips/comic/2007-08…
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…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

919 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now