Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Howto convert lines in stringified text into element of an array

by ikegami (Patriarch)
on Sep 04, 2007 at 03:33 UTC ( [id://636822]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    chomp( my @array = $file =~ /\G(.*\n|.+)/g );
    
  2. or download this
    my @array = $file =~ /\G(?=.)([^\n]*)\n?/sg;
    
  3. or download this
    my @array = $file =~ /\G(.*)(?:\n|(?<=.))/g;
    
  4. or download this
    open my $fh, '<', \$file;
    chomp( my @array = <$fh> );
    
  5. or download this
    my $array = \@array;
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (5)
As of 2024-04-19 04:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found