>perl -wMstrict -le "our $RtnVal; our $SomeOtherGlobal; ;; my $coderef = sub { $RtnVal = $_[0]; if ($RtnVal eq 'Ok') { $SomeOtherGlobal = 'Foo'; } }; ;; for my $arg (qw(Ok NotOk)) { $RtnVal = $coderef->($arg); print qq{RtnVal '$RtnVal'}; } ;; for my $arg (qw(Ok NotOk)) { $coderef->($arg); print qq{RtnVal '$RtnVal'}; } " RtnVal 'Foo' RtnVal '' RtnVal 'Ok' RtnVal 'NotOk'