#!C:\strawberry\perl\bin\perl.exe use dbi; use strict; use warnings; my $usernameentered = "user89"; my $passwordentered = "password12"; my $dbh = DBI->connect('dbi:mysql:Database','username','password') or die "Connection Error: $DBI::errstr\n"; my $sql = "select * from usertable"; my $sth = $dbh->prepare($sql); $sth->execute or die "SQL Error: $DBI::errstr\n"; while (my @row = $sth->fetchrow_array) { my @username= grep /$usernameentered/, @row; print "@username\n"; my @password= grep /$passwordentered/, @row; print "@password\n"; #if (@username !=$usernameentered) if ($username[0] ne $usernameentered)#??which index?? { print "incorrect username entered **$username[0]**\n"; } #if (@password !=$passwordentered) if ($password[0] ne $passwordentered)#??which index?? { print "incorrect password entered $password[0]**\n"; } }