in reply to perl grep help!

ok ive added eq instead on =! but I dont know how to get grep to search through my array and match passwords and usernames together......does anybody know?

Replies are listed 'Best First'.
Re^2: perl grep help!
by cdarke (Prior) on Mar 09, 2010 at 17:03 UTC
    @username = grep /^$usernameentered$/, @row;

    Will give you a list of all the columns containing only $usernameentered (note the ^ and $).
    unless (@username) { print "incorrect username entered @username\n"; }
Re^2: perl grep help!
by Illuminatus (Curate) on Mar 09, 2010 at 17:09 UTC
    Perhaps the best solution would be to replace the wildcard in the query with a named list, starting with username and password. Then, you could avoid grep altogether and just match the array elements directly. Or, you could keep the wildcard and fetchrow_hashref, and use the column names to find the info you need.