sub append :lvalue { no warnings 'uninitialized'; substr($_[0], length $_[0]); } my $x; for (1 .. 5) { append($x) = $_ } print $x;