in reply to Re: Vexing views of variables
in thread Vexing views of variables

The void-context $v is not an error, but it does generate a warning, which I didn't notice because I was naughty and didn't use warnings for my test script. Changing it to { no warnings 'void'; $v; } silences the warning (by brute force) and has the same effect.

sub { $v } would normally be a no-op, but, here, it's the last line statement of a function definition, so it carries an implicit return. Thus, mk_view_v() returns that anonymous sub, and we call it as we would any other coderef.

UPDATE: I should have said that the sub { $v } line carries 2 implicit returns—more explicitly, it's return sub { return $v }.