in reply to Re^2: How to store the data fetched from the database in perl
in thread How to store the data fetched from the database in perl
Try using my $hr_data = $dbh->selectall_hashref('SELECT DISTINCT EMP_NAME FROM EMPLOYEE', [ 'EMP_NAME' ]);
This fetches all data in one go.
You can then use
say "ABC exists" if exists $hr_data->{ABC};
to check if an element is there.