for my $i (0.. $#excerpts){ if (excerpts[$i] =~ /$re2/({ $%{$excerpts[$i]}{fpart} = $1; $%{$excerpts[$i]}{bpart} = $3; } } #### perl -wE '@a=(1,2,3); for(@a){/(2)/; say $1}' Use of uninitialized value $1 in say at -e line 1. 2 2