in reply to Download big file in chunks with plack response

while (<FILE>) { my $var = scalar $_; $response->body($var); return $response->finalize; }

$_ is already a scalar. Calling it in a scalar context doesn't change anything, so you can also use

my $var = $_;

If you return from a while loop, the loop is done. In fact, the whole subroutine is done. The next iteration never happens.

autoflush is documented in IO::Handle:

Any unread data in the buffer will be discarded

Are you sure you want to do that?

Update: You used flush on the input, not output. But perlvar for $| which is the same as autoflush says:

This has no effect on input buffering

map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]