Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Assigning multiple lines into first element of array

by tybalt89 (Monsignor)
on Feb 29, 2020 at 22:42 UTC ( [id://11113588]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    #!/usr/bin/perl
    
    ...
    open my $handle, '<', $filename or die "$! opening $filename";
    my @array = map s/>\z//r =~ s/^(?!>)/>/r, do { local $/ ="\n>"; <$hand
    +le> };
    use Data::Dumper; print Dumper \@array;
    
  2. or download this
    #!/usr/bin/perl
    
    ...
    open my $handle, '<', $filename or die "$! opening $filename";
    my @array = split /(?=>)/, do { local $/; <$handle> };
    use Data::Dumper; print Dumper \@array;
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (6)
As of 2024-03-28 20:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found