in reply to Re^2: why aren't I see the hash while using dump?
in thread why aren't I see the hash while using dump?

You _can_ typecast, however, like so (array to hash key value pairs)

use Data::Dumper; use warnings; use strict; open FOO, "test_data.txt" or die $!; my @A; while(<FOO>){ chomp; push @A, split /\s*=\s*/, $_, 2 } my %H = @A; print Dumper(\%H);

Included a maximum of 2 elements in the split, as suggested by An.Monk.

Replies are listed 'Best First'.
Re^4: why aren't I see the hash while using dump?
by Anonymous Monk on Jun 01, 2015 at 22:27 UTC

    You can, and it's a good thing to know sometimes, but in this case it'll cause strange things to happen if there's more than one = on a line. Your original suggestion was better, perhaps with the enhancement of giving the split a limit, e.g. split /\s*=\s*/, $_, 2.