http://www.perlmonks.org?node_id=986078


in reply to optional command line arguments

How about using prototypes to emulate your own block?

sub block(&) { shift->(); } my $a = shift @ARGV || block { print "Enter value for a:"; <STDIN> }; print "$a\n";