On Fri, Jul 04, 2003 at 06:02:21PM -0400, Steve Grazzini wrote:
> On Fri, Jul 04, 2003 at 02:18:40PM -0700, David Storrs wrote:
> > I've got a function that takes several arguments, the first of 
> > which should be a scalar (specifically, a string).  I'd like to 
> > have a precondition to verify that the argument is, in fact, a 
> > scalar.
> 
> I'll recommend that you *don't* try to do this.  If a user of
> your function wants to do
> 
>     my @args = (133, $x, $y);
>     your_function(@args);
> 
> you shouldn't mind[*].  The array will get flattened into a list
> of scalars, and the numeric value will automatically get converted
> into a string as soon as you use it as a string.

Oh, I wasn't worried about getting a number; that I can deal with
fine.  I was more worried about getting, e.g., a reference (if the
argument were accidentally given out of order).  Take the
length of a ref or trying to run a regex on it tends to not work.

I suppose I could just use named parameters.  

Anyway, thank you.

--Dks

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to