wolfie7873 has asked for the wisdom of the Perl Monks concerning the following question:
It seems my hash has gone wonky. It's affecting key matching downstream. Any guesses as where to look first?
foreach my $line ( @name_lines ) { #$/ = '\n' ; chomp($line) ; my @data = split '\|' , $line ; #map { $_ =~ s/[^a-zA-Z0-9_\@\. ]//g } @data ; #print Dumper @data ; my ( $name , $email , $wishlist , $address , $spouse_name ) = +@data ; $people{$name}{email} = $email ; $people{$name}{wishlist} = $wishlist ; $people{$name}{address} = $address ; $people{$name}{spouse} = $spouse_name ; if ( $spouse_name ne '' ) { $spouses{$name} = $spouse_name ; } } print Dumper %spouses ; $VAR1 = 'Jay'; ';AR2 = 'Shirley $VAR3 = 'Travis'; ';AR4 = 'Emmy $VAR5 = 'Trisha'; ';AR6 = 'Eddie $VAR7 = 'Eddie'; ';AR8 = 'Trisha $VAR9 = 'Shirley'; ';AR10 = 'Jay
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: dumper hash incorrect?
by Corion (Patriarch) on Oct 19, 2021 at 13:54 UTC | |
by BillKSmith (Monsignor) on Oct 19, 2021 at 17:47 UTC | |
Re: dumper hash incorrect?
by BillKSmith (Monsignor) on Oct 19, 2021 at 15:46 UTC | |
Re: dumper hash incorrect? (Data::Dump dd)
by Anonymous Monk on Oct 20, 2021 at 07:59 UTC | |
Re: dumper hash incorrect?
by perlfan (Vicar) on Oct 19, 2021 at 17:43 UTC | |
by Anonymous Monk on Oct 19, 2021 at 18:13 UTC |
Back to
Seekers of Perl Wisdom