Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Array issue

by Ovid (Cardinal)
on Jan 28, 2004 at 20:24 UTC ( #324769=note: print w/replies, xml ) Need Help??


in reply to Array issue

I'd really need more of your code to understand what's happening, but cleaning up your indentation revealed that you were missing a curly brace. Also, you want to push the passwords onto the list. Assigning a password to the list would simply overwrite the last password.

#!/usr/local/bin/perl use strict; use warnings; my @listOfPass; + open(INPUT , "<$input_file" ) or die "couldn't open ($input_file) :$!" +; + my ($section,%passwds); while(<CONFILE>) { chomp; if (/^\[(.*?)\]$/) { $section = $1; next; } if ($section eq 'PASSWORDS') { my ($mkt,$pass) = split; $passwds{$mkt} = $pass; $passwds{$pass} = $mkt; push @listOfPass, $pass; } }#end while loop close (INPUT);

Cheers,
Ovid

New address of my CGI Course.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (6)
As of 2023-03-28 17:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Which type of climate do you prefer to live in?






    Results (68 votes). Check out past polls.

    Notices?