in reply to Perl newbie question.
You could try to split your parameter and access the number of elements ... something like this:
my @nr = split (/\s+/, $_[0]); print ($#nr+1, " params \n");
However you might want to do some fine-tuning ... the code above won't work correctly for parameters starting with whitespaces
HTH, Rata
update: or as an one-liner: print (scalar(split (/\s+/, $_[0])), " params \n");
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Perl newbie question.
by kiruthika.bkite (Scribe) on Mar 19, 2010 at 09:24 UTC |