[OT] Help with Perl Script

Bruno Wolff III bruno at wolff.to
Wed Apr 21 12:24:08 UTC 2010


On Wed, Apr 21, 2010 at 10:20:27 +0100,
  Dan Track <dan.track at gmail.com> wrote:
> 
> Basically to improve my perl scripting, I've given myself a challenge
> where I would like to order the users in the passwd file by uid, I
> could do this in another language but I'm focused on improving my perl
> scripting. The script I've written so far is below, I've managed to
> figure out hashes and have read in the file and created a hash of
> hashes. It's after this that I'm stuck, I'm struggling to order the
> hash of hashes by uid and then print the ordered list out? Can someone
> please help me to finish this off? I'm trying to avoid using perl
> modules as I want to improve my scripting ability.

It looks like you are doing string comparisons on the uid. I think you
might want to try <=> instead of cmp.


More information about the users mailing list