in reply to newbie - hash - array?

The coding is fine (TMTOWTDI) - The problem lies with just one line, line 10.
My way to get it working was to modify the first block of code so it says this:
open(USER_LIST, '/etc/passwd') or die "Couldn't open: $!"; while (<USER_LIST>) { @user_info = split /:/, $_; $user_dict{$user_info[0]} = $user_info[4] . " " . $user_info[5]; }

I think the problem is here :
@user_info[4,5]; #same as ($user_info[4],$user_info[5]);
although I don't know what the \ that you have there does...
setantae@eidosnet.co.uk|setantae|http://www.setantae.uklinux.net

Replies are listed 'Best First'.
The Mysterious Slash
by chromatic (Archbishop) on Feb 11, 2000 at 09:31 UTC
    The \ you're both confused about actually creates a reference to the variable it precedes. In the code, it assigns a reference to the array of @user_info[4,5] as the value of the hash.

    You need to read perldoc perlref. (Pay close attention to how you dereference a reference.)