use warnings; use strict; my $foo = "bar"; DoIt(); sub DoIt { my $it = shift // $foo; # Given the C background of the author, I can see why the line was written as is. However, it was supposed to be # my $it = shift; // $foo print "it is '$it'\n"; }