I am trying to write a Perl CGI script that prints /etc/passwd users but when I open my CGI my scrolling list just prints out multiple lines of this:
"HASH(0x27836d8)"
Here is my code where I grab etc passwd and print it to the scrolling list. Can anyone help me out with printing this correctly to the scrolling list?
setpwent();
while (@list = getpwent())
{
($LOGIN,$PASSWORD,$UID,$GID,$QUOTA,$COMMENT,$GECOS,$HOMEDIR,$SHELL) = @list[0,1,2,3,4,5,6,7,8];
if( $UID >= 1001 )
{
push @users, { login => "$LOGIN"};
}
}
endpwent();
print scrolling_list(-name=>'user_list',
-values=>[@users],
-size=>15);
You gave the list a bunch of hash references, so that’s what got displayed. Change
to