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

Re: Assigning multiple lines into first element of array

by tybalt89 (Prior)
on Mar 01, 2020 at 02:00 UTC ( #11113593=note: print w/replies, xml ) Need Help??


in reply to Assigning multiple lines into first element of array

Simple "line at a time" version.

#!/usr/bin/perl use strict; # https://perlmonks.org/?node_id=11113581 use warnings; my $filename = 'file.fasta'; open my $handle, '<', $filename or die "$! opening $filename"; my @array; while( <$handle> ) { /^>/ and push @array, ''; $array[-1] .= $_; } 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://11113593]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (5)
As of 2021-08-02 14:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My primary motivation for participating at PerlMonks is: (Choices in context)








    Results (27 votes). Check out past polls.

    Notices?