Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Array issue

by pelagic (Priest)
on Jan 28, 2004 at 20:31 UTC ( #324775=note: print w/replies, xml ) Need Help??


in reply to Array issue

Hi
I'll try to explain what each of your stmts does:

 my ($mkt,$pass) = split;
assign first word of line (user or whatever that is) to $mkt
and Password (second word of line) to $pass

$passwds{$mkt} = $pass;
assign Password to hash/key %passwds/$mkt
assign User to hash/key %passwds/$pass
At the end you got a hash with every User _AND_ every Password as key. The values contain vice versa the Passwords and the Users.
Now it's impossible to have just a list of the Passwords because you cannot distict them anymore.

just do:
$passwds{$mkt} = $pass; in your loop and then you can get all Users or all Passwords like that:
@listOfPass = (values %passwds); @listOfUsers = (keys %passwds);
Imre

PS
close if stmt with } before accessing the whole list ...

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://324775]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (3)
As of 2023-04-01 14:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?