Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: How do I read the contents of a file?

by nite_man (Deacon)
on Mar 07, 2003 at 12:56 UTC ( [id://241122]=note: print w/replies, xml ) Need Help??


in reply to How do I read the contents of a file?

You can use the function read for reading of file content in the string variable:
my $file_cont; # define a variable for keeping of file content my $fname = '/tmp/your_file'; open INPUT, $fname or die "Can't open file $fname: $!"; binmode INPUT; # If your file is binare read INPUT, $file_cont, -s $fname; close INPUT or die "Can't close file $fname: $!";
Format of function  read is following:
read FILEHANDLE,SCALAR,LENGTH,OFFSET or read FILEHANDLE,SCALAR,LENGTH

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (2)
As of 2024-04-26 03:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found