sub test { my $arg = shift; my $bar; if($arg) { $bar = "true"; } return $bar; } my $foo = 1; print test($foo);