Calling an interactive perl script from within a while-read loop

Hi,

I have a perl script that prompts for a user to enter a password before doing what it does. This works well if I call it directly from a bash script

#!/bin/bash
/path/to/perl/script $arg1 $arg2

But, when I try to enclose this within a while read loop, the perl script is called but if I enter an incorrect password, I do not get prompted again and the loop moves on to the next run.

#!/bin/bash
while read line 
arg1=`echo $line | sed 'something'`
arg2=`echo $line | sed 'something else'`
/path/to/perl/script $arg1 $arg2 < /dev/tty
done < /path/to/file

Any suggestions on how can I fix this problem? I would like to be prompted and allowed to enter the password as many times as the perl script allows me to before moving on.

Thanks!

The perl script is reading the password from standard input.

Inside the while loop, standard input is /path/to/file, so it reads the next line, fails the password, and quits the loop after only processing half of the lines.

Do ./perl-script ... < /dev/tty to read the password from the keyboard properly.