use Net::SNMP::Util; open $input_fh, '<', "MIB_OID.dat" or die 'Could not open file: ', $OS_ERROR; my %hash; while ( my $line = <$input_fh> ) { chomp $line; last if ! $line; my ( $word1 , $word2 ) = split /:/, $line, 2; $hash{$word1} = $word2; }