Asking username and password in the middle of the Shell/perl script

Can any body help me to find out the logic
I have a script chkcomponent.pl Which give some output
Like
component1 userid: u1
component2 userid: u2
component3 userid: u1
.
.
#The no of components are different in different times run
Now I want this chkcomponent.pl script in another script
myscript.pl/sh

problem:-
I want to check all component are running or not
But the problem is that this component are in different different userid So I want to login to different userid separately and check components individually

So I want to put a logic in myscript.pl/sh
which take all userid as argument and ask for password

So that I will check all the component at a time
:wall:

see if this work

 
while read one two user
         do
        echo "please enter passwd for $user "
        done <sample

please enter passwd for u1
please enter passwd for u2
please enter passwd for u1

where sample is output from ur previous script