in reply to Question: Is undef a valid argument?
How else would you (recommend) check for passed arguments to be present if this does not work?
I would either pass the content of @ARGV or a reference to it myself:
use strict; use warnings; mysub1(@ARGV); mysub2(\@ARGV); exit(0); sub mysub1 { my @args = @_; print "There were " . scalar(@args) . " arguments: @args\n"; } sub mysub2 { my ($args) = @_; print "There were " . scalar(@$args) . " arguments: @$args\n"; }
|
|---|