use strict; my %password = %{ read_passfile('/etc/passwd') }; sub read_passfile { open (PF, shift) or die "Couldn't read password file: $!"; return { map {chomp;split(':',$_,2)} }; }