in reply to using an array in place of a file when calling a hash

ok, try this put this at the top of the script;

open my $fh1, '<', "/tmp/host/mon2a" or die "unable to open file 'fi +le' for reading : $!"; my @fromfile=<$fh1>; close $fh1;
then change
open my $fh1, '<', "/tmp/host/mon2a" or die "unable to open file 'file +' for reading : $!"; while (<$fh1>)
to
for (@fromfile)
This code also suffers from other problems, use strict; use warnings; would help a lot.

Untested, YMMV