Sorting the alpha numeric results of Hash

Hi All

I've got a perl script that I'm having a problem with when it prints the output of a hash. Some background. I'm trying to merge two file with a similar structure but with different data. Here is a portion of the script I'm using.

       while (<INPUT>) {
                my $sLine = $_;
                @saFields = split ',' , $sLine;
                if ($saFields[2] ne "") {
                        $sScenario = $saFields[2] ;
                        $sScenario =~ s/"//g;
                        $shHash->{$sScenario}->{'Line'} = $sLine;
                        next;
                }
                $sRF = $saFields[5] if $saFields[5] ne "";
                $sTime = $saFields[6] if $saFields[6] ne "";
                push @{$shHash->{$sScenario}->{$sTime}->{$sRF}} , $sLine;
        }

        close INPUT;
}

foreach $sScenario (sort keys %{$shHash}) {
        print $shHash->{$sScenario}->{'Line'};
        foreach $sTime (sort {$a <=> $b} keys %{$shHash->{$sScenario}}) {
                foreach $sRF (sort {$a <=> $b} keys %{$shHash->{$sScenario}->{$sTime}}) {
                        print @{$shHash->{$sScenario}->{$sTime}->{$sRF}};
                }
        }


My input file looks like this with their relevant hashes hierarchy

SSMC_1 - This is $sScenario
,,,0,, - These are $sTime
,,,1,,
,,,3,, -
SSMC_2 -> Sequence repeated again - This is $sScenario
,,,0,, - These are $sTime
,,,1,,
,,,3,, -
SSMC_10
..
SSMC_11

But when I print the the output, it looks like this

SSMC_1
,,,0,,
,,,1,,
,,,3,, -
SSMC_10
,,,0,,
,,,1,,
,,,3,, -
SSMC_11
,,,0,,
,,,1,,
,,,3,, -
SSMC_2
,,,0,,
,,,1,,
,,,3,, -

Sorting the time hash works fine but the scenario, (line underlined in bold above) doesn't. I'm not sure if it's because it's an alpha-numeric hence why the sort doesn't work. Tried googling but to no avail and I'm at a loss

Thanks in advance

---------- Post updated at 04:05 PM ---------- Previous update was at 11:41 AM ----------

This problem has been solved. Thanks for those who had a look.

I simply removed the characters
$sScenario =~ s/SSMC_//g;

And then sorted it. As simple as that.