Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

File Opening

by vinoth.ree (Monsignor)
on Feb 06, 2010 at 06:37 UTC ( #821713=perlquestion: print w/replies, xml ) Need Help??
vinoth.ree has asked for the wisdom of the Perl Monks concerning the following question:

Is opening a file like this open(FH,">"."$path") or die $!;fail some times?

Replies are listed 'Best First'.
Re: File Opening
by biohisham (Priest) on Feb 06, 2010 at 06:58 UTC
    Have you tried it and what did you observe???

    If you are trying the three-argument open each argument would be comma separated.

    In the above line you provided, I suspect that the dot operator is prefixing $path with ">" via concatenation. However, ">" is still interpreted as the mode for output and it opened the file and wrote to it successfully when I tried it...

    Excellence is an Endeavor of Persistence. Chance Favors a Prepared Mind.
      The OP is a troll and you fell for it.

      I used this code, but some time is says that file can not be opened

        What reason did it give?
        Typical lie
        $ perl -le " for(1..1024){ print $!=$_ } " |grep -i open Too many open files in system Too many open files
Re: File Opening
by toolic (Bishop) on Feb 06, 2010 at 14:10 UTC
    open will fail if you do not have permission to write to the specified directory or the file already exists and you do not have pemission to overwrite it. There may be other reasons for it to fail (such as a non-existent directory), which is the reason you used die and $! to tell you why it is failing.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://821713]
Approved by keszler
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (2)
As of 2018-05-27 20:36 GMT
Find Nodes?
    Voting Booth?