spoiling

SOLVED: Hash content access is inconsistent with different perl version

喜你入骨 提交于 2020-03-23 08:19:47
问题 I came across an interesting problem with following piece of code in perl 5.22.1 and perl 5.30.0 use strict; use warnings; use feature 'say'; #use Data::Dumper; my %hash; my %seen; my @header = split ',', <DATA>; chomp @header; while(<DATA>) { next if /^\s*$/; chomp; my %data; @data{@header} = split ','; push @{$hash{person}}, \%data; push @{$hash{Position}{$data{Position}}}, "$data{First} $data{Last}"; if( ! $seen{$data{Position}} ) { $seen{$data{Position}} = 1; push @{$hash{Role}}, $data