%RegStudentNew = qw( foo 1 bar 2 ); %RegInstructorNew = qw( foo 1 bar 2 ); %RegStudentExisting = qw( foo 1 bar 2 ); print "New Student Registrations\n----------------------\n"; foreach my $Inst (sort keys %RegStudentNew) { if ($RegStudentNew{$Inst} ) { print "$Inst\t$RegStudentNew{$Inst}\n"; } } print "\nNew Instructor Registrations\n--------------------\n"; foreach my $Inst (sort keys %RegInstructorNew) { if ($RegInstructorNew{$Inst} ) { print "$Inst\t$RegInstructorNew{$Inst}\n"; } } print "\nExisting Student Registrations\n-----------------\n"; foreach my $Inst (sort keys %RegStudentExisting) { if ($RegStudentExisting{$Inst} ) { print "$Inst\t$RegStudentExisting{$Inst}\n"; } } #### cpt2jmo@phantom:~/misc$ perl print.pl New Student Registrations ---------------------- bar 2 foo 1 New Instructor Registrations -------------------- bar 2 foo 1 Existing Student Registrations ----------------- bar 2 foo 1