I think maybe we're misunderstanding each other somehow. I think the reason the OP's search loop is not finding anything in the array is because each of the array keys has an extraneous newline at the end. Take that off (with chomp), and it should be fine.
use Test::More 'tests' => 4;
my $line;
my %faclist;
$line = "17\n";
$faclist{$line} = "";
$line = "23\n";
chomp $line;
$faclist{$line} = "";
ok( ! exists $faclist{17}, 'number 17 does not exist' );
ok( ! exists $faclist{'17'}, 'string 17 does not exist' );
ok( exists $faclist{23}, 'number 23 exists' );
ok( exists $faclist{'23'}, 'string 23 exists' );
|