http://www.perlmonks.org?node_id=323702


in reply to making loop in perl script

It looks like you've posted some code that makes up passwords -- I haven't tried it -- and shown roughly how you call it. Your code fragment isn't complete -- I am guessing you have a list of users and want to create unique passwords for each user, but I can't tell.

Maybe you want to do something like this

my @users = qw/Albert Bob Charlie/; foreach my $thisUser ( @users ) { my $password = makePassword(); my $sql = "INSERT INTO login (login, password) VALUES (?,?)"; my $sth = $dbh->prepare($sql); $sth->execute($thisUser, $password); }

Alex / talexb / Toronto

Life is short: get busy!