Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re^3: perl can find the file but can not open the file

by 7stud (Deacon)
on Mar 11, 2013 at 05:23 UTC ( #1022738=note: print w/ replies, xml ) Need Help??


in reply to Re^2: perl can find the file but can not open the file
in thread perl can find the file but can not open the file

So I searched the internet and found the site that suggested the single quotes

So your question boils down to: "In the following code, I used the exact same string for a file test and in open(), yet my code doesn't work as expected:

if ( -e "$file" ) open ( FH0, '<./$file' )

Stripping away the code, one can only wonder why you think the two strings:

"$file"
 '<./$file' 

...are the same. There are several differences.

So I searched the internet and found the site that suggested the single quotes

You can learn about the difference between double quotes and single quotes, as well as many other useful things, like how to properly open() a file, which you aren't doing, in "Learning Perl 6th".

Is there a way to find all the dependencies before I try to install a module from CPAN?

Well, most people don't install from source. Instead, they just type:

$ cpan Some::Module

and the cpan command handles downloading and installing all the dependencies. However, the first time you try to use the cpan command, you have to do some setup, which may or may not go smoothly.

More recent versions of perl come with the cpanm command, which stands for cpan minus, which is like cpan, but with no setup required:

$ cpanm Some::Module

And if you don't have cpan minus, you can download the App::cpanminus module from cpan.

There are two kinds of perl, modern perl and the shite that existed before that. You seem to be learning the shite. I suggest you alter course.


Comment on Re^3: perl can find the file but can not open the file
Download Code
Re^4: perl can find the file but can not open the file
by ShermW0829 (Acolyte) on Mar 11, 2013 at 14:53 UTC

    Thank you, 7stud. Poker player? That is what I started with in 1968 and have been a poker fan since. Played for a living in Las Vegas for two years. Loved it.

    I found that I have cpan cpanm and cpanp by using the which command. I also found that an update is available for cpan so I installed that by using sudo cpan install CPAN. Sherman

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (4)
As of 2014-09-22 00:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (176 votes), past polls