my @a; for (qw/a b c/) { push @a, $_; print (join ', ', @a), "\n"; } #### a #### a # output from previous iteration a, b # output from current iteration
## a ##
## a # output from previous iteration a, b # output from current iteration