Conversion from Perl to Shell scripting

Hai ! I am doing a research on Bioinformatics and a part of the code in perl have to be converted to shell scripting. I am new to shell programming. Pls. kindly help me to convert this code to shell script though it is somewhat lengthy.
PLS KINDLY HELP ME. THANKS IN ADVANCE.

my @FreeEnergy = `grep -e \'dG\' t1.ct`;
my @dG;
foreach my $fE (@FreeEnergy) {
my @vals = split(' ',$fE);
push(@dG,$vals[3]);
}
my $recSep = $/;
$/ = 'Structure';
open STR, '<', 't1.out' or die "cannot open file \n";
my @structures = <STR>;
close STR;
$/ = $recSep;
my @hairpins = `grep -e \'Structure\' -e \'Hairpin loop:\' -e \'Multi\-loop\' t1.det`;
my ($h,$m) = (0,0);
my (@H,%HairPins,%Multi,@M);
for (my $i=0;$i <@hairpins;$i++) {
my $line = $hairpins[$i];
chomp $line;
if ($line =~ /Structure/) {
if (@H) {
$h++;
my @NH = @H;
my @NM = @M;
$HairPins{$h} = \@NH;
$Multi{$h} = \@NM;
@H = ();
@M = ();
}
} elsif($line =~ /Hairpin/) {
my ($s1,$s2) = ($line =~ /Closing pair is \D\(\s+(\d+)\)-D\(\s+(\d+)\)/);
my $hLoop = "$s1-$s2";
push(@H,$hLoop);
if($i == scalar @hairpins-1) {
$h++;
my @NH = @H;
$HairPins{$h} = \@NH;
my @NM = @M;
$Multi{$h} = \@NM;
@M = ();
@H = ();
}
}
else {
my ($s1,$s2) = ($line =~ /closing pair is \D\(\s+(\d+)\)-\D\(\s+(\d+)\)/);
my $mLoop = "$s1-$s2";
push(@M,$mLoop);
}
}

First write the corresponding pseudo code of what it does