Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

Re: How do I write to a file?

by chromatic (Archbishop)
on Mar 05, 2000 at 07:49 UTC ( #4891=note: print w/replies, xml ) Need Help??

in reply to How do I write to a file?

Always, ALWAYS check the return value of a command such as open: open INPUT "myfile.txt" || die "Cannot open file: $!"; This will save you hours of aggregate troubleshooting when your program fails silently. (The special variable $! contains the error message. Print it to discover why the file couldn't be opened.)

Replies are listed 'Best First'.
Re: Answer: How do I write to a file?
by I0 (Priest) on Apr 08, 2002 at 06:22 UTC
    #I think you meant either open INPUT, "myfile.txt" or die "Cannot open file: $!"; #or (open INPUT, "myfile.txt") || die "Cannot open file: $!"; #"myfile.txt" || die "Cannot open file: $!" is always true

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (1)
As of 2021-05-09 11:21 GMT
Find Nodes?
    Voting Booth?
    Perl 7 will be out ...

    Results (100 votes). Check out past polls.