Solved

ActiveState Perl for Win32

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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

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…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
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…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

706 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

14 Experts available now in Live!

Get 1:1 Help Now