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

Re: Text manipulation

by Anonymous Monk
on Nov 09, 2012 at 17:46 UTC ( #1003192=note: print w/ replies, xml ) Need Help??

in reply to Text manipulation

use 5.014; use strict; use warnings; my @f1 = qw( >qppq ATATATTTATTATTA TATATATTATATTAT TA >lsl ATTATTATTATTATT AGGAGGAG ); my @f2 = qw( >dfj TATTATTATTTT ATAT >ghg ATATATAT ); { my $i = 1; sub get_lines { my $array_ref = shift; $i = shift if @_; my $old = $i - 1; while (exists $array_ref->[$i] and chr ord $array_ref->[$i] ne '>') { $i++; } return splice($array_ref) if $#{$array_ref} <= $old; return splice($array_ref, $old, $i - $old); } while (@f1 && @f2) { my $j = $i; say join("\n", get_lines(\@f1, $j), get_lines(\@f2, $j)); say "============"; } } # TZN

Comment on Re: Text manipulation
Download Code

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (16)
As of 2015-07-29 16:15 GMT
Find Nodes?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...

    Results (265 votes), past polls