#!/usr/bin/perl sub foo :lvalue { if( $_[0] ) { $bar } else { $baz } } foo($ARGV[0]) = 32; print "Bar: $bar, Baz: $baz\n" #### buu@its01:~$ perl test.pl 1 Bar: 32, Baz: #### buu@its01:~$ perl test.pl 0 Can't return a temporary from lvalue subroutine at test.pl line 15.
## buu@its01:~$ perl test.pl 1 Bar: 32, Baz: ##
## buu@its01:~$ perl test.pl 0 Can't return a temporary from lvalue subroutine at test.pl line 15.