Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Reading file from other directory

by sara1612 (Initiate)
on Dec 30, 2019 at 11:29 UTC ( #11110763=perlquestion: print w/replies, xml ) Need Help??

sara1612 has asked for the wisdom of the Perl Monks concerning the following question:

i am unable read content of file from other dirdectory

Replies are listed 'Best First'.
Re: Reading file from other directory
by Discipulus (Abbot) on Dec 30, 2019 at 12:00 UTC
    Hello sara1612 and welcome to the monastery and to wonderful world of Perl!

    Remember to show always what are you trying before asking (so short) questions: clear questions and runnable code get best answers is on of our mottos.

    Generally to read from file in other than current directory you need to specify a full path or a relative, correct one: see Cwd and File::Spec

    Show us more to get more help back!

    L*

    There are no rules, there are no thumbs..
    Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.
Re: Reading file from other directory
by davido (Cardinal) on Dec 30, 2019 at 16:17 UTC

    What did you try?

    The way your brief question is worded leaves the impression that you assume there is only one obvious answer. But the fact is there are numerous ways to read a file from some other directory, and in fact, numerous meanings of "other directory." The guessing game is inefficient. So please ask a complete question.


    Dave

Re: Reading file from other directory
by soonix (Canon) on Dec 31, 2019 at 16:13 UTC
    Hello sara1612, perhaps it will help, if you understand what absolute and relative paths are. You are probably referring to the files simply by their name, which is (the most common form of) a "relative path". If you use "full" paths, you can access them regardless of your current working directory.
Re: Reading file from other directory
by AnomalousMonk (Bishop) on Dec 30, 2019 at 22:57 UTC
Re: Reading file from other directory
by karlgoethebier (Monsignor) on Dec 30, 2019 at 16:26 UTC

    Too bad. See Path::Tiny for some inspiration.

    «The Crux of the Biscuit is the Apostrophe»

    perl -MCrypt::CBC -E 'say Crypt::CBC->new(-key=>'kgb',-cipher=>"Blowfish")->decrypt_hex($ENV{KARL});'Help

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://11110763]
Approved by marto
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (9)
As of 2020-06-02 09:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you really want to know if there is extraterrestrial life?



    Results (16 votes). Check out past polls.

    Notices?