local $/ = "Startpoint"; $temp="abc"; while(){ /[(](\w+)[^(]+[(](\w+)[^:]+:\s+(\w+).*?slack[^-]+(-\S+)/s; $PG{$3}{"$1-$2"}{"$cou"} = $4; $cou++; } #### my %PG; my $cou = 0; local $/ = 'Startpoint'; RECORD: while () { next RECORD unless # unless valid data extracted from record /[(](\w+)[^(]+[(](\w+)[^:]+:\s+(\w+).*?slack[^-]+(-\S+)/s; $PG{$3}{"$1-$2"}{$cou} = $4; $cou++; } #### --------------undefined key of my hash--------------- '' => { '-' => { '' => undef } },