#!/usr/bin/perl -w use strict; foo(4); foo(); { my $bar; sub foo { $bar = shift unless defined $bar; print "$bar\n"; } } __END__