#! perl -slw use strict; use Data::Dump qw[ pp ]; my %records; until( eof( DATA ) ) { my %record; ## put the exon number inside the record ( $record{ exon } ) = ( =~ m[(\d+)] ); my $seqs = 1; my $line = ; if( $line =~ m[(\d+) different hits] ) { $seqs = $1; $line = ; } ( $record{ gene_id } ) = ( $line =~ m[GI:(\d+)] ); ( $record{ Nm_id } ) = ( =~ m[(NM_\d[\d]+)] ); ## save the snoRNA text... chomp( my $snoRNA_key = ); for( 1 .. $seqs ) { my $query = [ split ' ', ]; shift @$query; scalar (); my $sbjct = [ split ' ', ]; shift @$sbjct; push @{ $record{ seqs } }, { query => $query, sbjct => $sbjct }; } chomp( $record{ gene_name } = ); chomp( $record{ web_link } = ); ## And use it as the primary key in the main hash push @{ $records{ $snoRNA_key } }, \%record; } pp \%records; __DATA__