Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Output to file question

by ysth (Canon)
on Jul 21, 2004 at 22:48 UTC ( [id://376401]=note: print w/replies, xml ) Need Help??


in reply to Output to file question

One way:
use File::Slurp "write_file"; write_file("filename", $mac) or die "Error writing to file: $!";
or, more traditionally,
open my $handle, "> filename" or die "Couldn't open file: $!"; print $handle $mac; close $handle;
(Ideally, you should check if the print and close fail also; this is commonly overlooked.)

Replies are listed 'Best First'.
Re^2: Output to file question
by dannyp (Novice) on Jul 21, 2004 at 23:45 UTC
    Thanks

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (2)
As of 2024-04-19 19:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found