while () { $alarm_details{ $1 } = $2 if /^(.*)=(.*)$/; } #### { open my $fh, '>', 'hash.i' or die $!; print $fh Dumper(\@alarm_details); } #### my $alarm_details_ref = do '/path/to/hash.i'; #### my @old_alarm_details = @{do '/path/to/hash.i'};