my %h; while () { $key = $1, next if /^Window ([^:]+)/; push @{$h{$key}}, $_; }