sub myMethod { my ($param) = @_; return sub { if ($param) { print "Woohoo, you have successfully passed in a parameter ($param).\n"; } else { print "You have not attempted to pass in a parameter.\n"; } } } my $methodWithoutParam = myMethod(); $methodWithoutParam->(); my $methodWithParam = myMethod('My Param'); $methodWithParam->();