#!/usr/bin/perl use strict; use warnings; my %hash; while (my $line = ) { chomp $line; next if $line =~ /dG\s=\s(.*?)\s/; my ($sNum, $nt, undef, $connect) = split(/\s+/, $line); $hash{$nt} = $connect; } foreach my $key (keys %hash) { print "$key\t$hash{$key}\n"; } __DATA__ 300 dG = -62.54 [initially -70.70] gi178893_M23263_rna_300-1 4 U 3 5 0 4 5 U 4 6 0 5 14 G 13 15 30 14 15 A 14 16 29 15 16 G 15 17 28 16 18 A 17 19 26 18 19 C 18 20 25 19 #### A 19 C 20 G 17 U 6