Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: How do i read each line of the file into string?

by koolade (Pilgrim)
on May 09, 2001 at 17:39 UTC ( #79075=note: print w/replies, xml ) Need Help??


in reply to How do i read each line of the file into string?

my $string; # Open the file open(FILE, "$file_name") or die "could not open $file_name : $!"; # Iterate over each line of the file while (<FILE>) { # Take off trailing newline chomp; # Append line and comma to the string $string .= "$_,"; } # Close the file close(FILE); # Chop off trailing comma chop $string;

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (3)
As of 2022-08-14 00:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?