in reply to Capturing No-values Region in Regex match
Try this:
Note that I turned %hoa into $hoa; I think it's easier to work with hashrefs in this case.my %bighash; my $motif; my $score; my $hoa; # formerly %hoa my $tag; while ( <DATA> ) { chomp; my @aoa; if ( /^TAG/ ) { $tag = (split(/: /,$_))[1]; die "No tag!" unless $tag; $bighash{ $tag } = $hoa = +{}; } elsif(/^MOTIF/) { ($motif,$score)=(split (/[\s,]/,$_))[1,3]; push @{$hoa->{$motif}}, $score; } elsif(/^\d,-\d+,[ATCG]*$/) { @aoa = split(/,/,$_); push @{$hoa->{$motif}}, [ @aoa ]; } #print Dumper $hoa ; } # ----- end while -----
the lowliest monk
|
|---|