Solved

ActiveState Perl for Win32

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Many time we need to work with multiple files all together. If its windows system then we can use some GUI based editor to accomplish our task. But what if you are on putty or have only CLI(Command Line Interface) as an option to  edit your files. I…
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…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

806 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