Code: print "Before fubar\n" . Dumper(@g::TaskList); $Body .= "$_
" while(); print "After fubar\n" . Dumper(@g::TaskList); Output: Before fubar $VAR1 = 'Localize'; $VAR2 = 'ErrorCheck'; After fubar $VAR1 = undef; $VAR2 = 'ErrorCheck'; #### Working (identical?) version: while (my $line = ) { $Body .= "${line}
"; }