#!/usr/bin/perl -w use strict; my @array = qw(a b c d e f g); my %hash = ( '1st' , 'a', '2nd' , 'b', '3rd' , 'c', ); while (<@array>) { print; } foreach my $key (sort keys %hash) { print "$key: $hash{$key}\n"; }