in reply to Test Number of Elements In Array
but not sure if that really works...Then just test it for yourself:
use strict; use warnings; my @a0; my @a1 = 1; my @a2 = 0..5; check(@a0); check(@a1); check(@a2); sub check { if (@_ == 1) { #if ((scalar @_) == 1) { print "exactly 1\n"; } else { print "diff from 1\n"; } } __END__ diff from 1 exactly 1 diff from 1
Your original method seems to work pretty well.
You could make it more verbose by using scalar. You decide which is simpler for you to understand.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Test Number of Elements In Array
by AnomalousMonk (Archbishop) on Jun 05, 2009 at 17:32 UTC | |
by chromatic (Archbishop) on Jun 05, 2009 at 18:20 UTC |