Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Assigning multiple lines into first element of array

by tybalt89 (Monsignor)
on Mar 01, 2020 at 02:00 UTC ( [id://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?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (6)
As of 2024-04-25 10:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found