use constant NAME => 2; use constant ID => 0; # ... my @row = $sth->fetchrow_array; print "Hi, Bob!\n" if $row[NAME] = 'Robert';