##
my $fetch = sub {
my ($fh) = @_;
return if eof $fh;
return \(scalar <$fh>);
};
...
while (my $ref = $next->()) {
print "$$ref\n";
}
####
my $fetch = sub {
my ($fh) = @_;
return if eof $fh;
return scalar <$fh>;
};
...
# RIGHT: while (my ($item) = $next->())
# WRONG: while (my $item = $next->())
while (my ($item) = $next->()) {
print "$item\n";
}