in reply to Selective Parsing Problem
#!/usr/bin/perl use Data::Dumper; $Data::Dumper::Indent = 1; my $ary = []; my $i = -1; while (<DATA>) { chomp; s/\r//; /^Mtf.*\s(\S+)$/ and push @{ $ary->[++$i] }, $1; # next array /\s+St f\d+/ and push @{ $ary->[$i] }, $_; } print Dumper($ary); __DATA__ - your data here -
Output:
$VAR1 = [ [ 'CGATATYGAWTSSTT', '>2522963-2522975-reverse St f145 CGATATCGAATCGCT', '>2522963-2522975-reverse St f156 CGCTATTGAATGCGT' ], [ 'AAKSAWTYRATATCG', '>2522963-2522975-reverse St f82 AAGGAATTAATATCG', '>2522963-2522975-reverse St f138 AATCCATCGATATCG' ], [ 'TCGMTATCGAWTSGC', '>2522963-2522975-reverse St f144 TCGATATCGAATCGC', '>2522963-2522975-reverse St f155 TCGCTATTGAATGCG', '>2522963-2522975-reverse St f204 TCGCTATAAAAAGGC' ] ];
--shmem
_($_=" "x(1<<5)."?\n".q·/)Oo. G°\ /
/\_¯/(q /
---------------------------- \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}
|
|---|