$employee_id = (defined $row[0]) ? $row[0] : ''; #### @foo = $sth->fetchrow_array(); if (@foo) { ... } else { ... }