What you are looking for is the sort function.

However, I think you are over complicating things somewhat.
Consider the following:

#!/usr/bin/perl use strict; use warnings; my %people; while (my $line = <DATA>) { chomp($line); my ($person, $occupation, $hours) = split /\s+/, $line; $people{$person}{occupation} = $occupation; $people{$person}{hours} = $hours; } for my $person (sort keys %people) { print "Name: $person\n"; print "Job: $people{$person}{occupation}\n"; print "Hours: $people{$person}{hours}\n"; print "------------------\n"; } __DATA__ Mike Plumber 80 Laura Programmer 60 Mark Sales 70 Jeremy Cook 65
Does this do what you want?

Cheers,
Darren :)


In reply to Re: Sort lists/Data Structures by McDarren
in thread Sort lists/Data Structures by mmontemuro

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":