Help with script

I have n different internet providers and I want to call them to get my mail.
os in a file I have like this:

user1:pass1
user2:pass2
user3:pass3

I need a pice of code that open the file acount.txt

and read user and pass into 2 different variables and I don't know how to fix this.
I like some kind of aray
that I can step through and a counter.
so for n=1
the variable user shall have the value=user1
and pass=pass1
and for n=2 user shall have the value user2 and pass the value=2

how can I fix this
LVL 1
puckoAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Kim RyanIT ConsultantCommented:
open(IN_FH,"<account.txt");
@lines = <IN_FH>;
foreach $line (@lines)
{
   ($user,password) = split(/:/,$line);
}
close(IN_FH);
0
ahoffmannCommented:
foreach $l (`cat acount.txt`) {($u,$p)=split(/:/,$l);$u_p{$u}=$p;}
# keys %u_p  returns users
# values %u_p returns passwords
# $u_p{'user1'} is direct access
# to be improved anyhow
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ahoffmannCommented:
oops, there was no comment when I made my suggestion
0
Kim RyanIT ConsultantCommented:
Embedding Unix commands like 'cat' in your perl script tend to make you them less portable.
0
ahoffmannCommented:
teraplane, you're absolutely right
I usually use open(), but posted a quick&dirty solution (see my comment ;-)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Perl

From novice to tech pro — start learning today.