in reply to Re: Question: Is undef a valid argument?
in thread Question: Is undef a valid argument?
Spoke too soon.
None of what you sggested works.
Try passing nothing to the script you will see it still states one argument.#! /usr/bin/perl use strict; use warnings; sub p1 { my $n1; $n1=scalar(@_); if (@_) { print "Has elements\n"; } print "1. Parameters to the sub p1 $n1\n"; my $p1=shift; if (@_) { print "Has elements\n"; } else { print "Has no elements\n"; } print "2. p1=$p1\n"; } p1 $ARGV[0];
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Question: Is undef a valid argument?
by ikegami (Patriarch) on May 07, 2009 at 00:07 UTC | |
|
Re^3: Question: Is undef a valid argument?
by kennethk (Abbot) on May 06, 2009 at 22:01 UTC |