On Fri, Jul 04, 2003 at 06:03:55PM -0400, Casey West wrote: > It was Friday, July 04, 2003 when David Storrs took the soap box, saying: > : 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. Is > : there a way to do that (preferably without using modules--I'm trying > : to write an entirely self-contained script). > > Provided that you really have a function, that you're calling as a > function, you can use prototypes. They are documented in perlsub, and > have the following syntax. > > sub function($) { > > } > > This will require the first argument to be scalar. If the first > argument is mandatory, follow the dollar sign ($) with a semi-colon > (;).
Thanks Casey, I was trying to avoid prototypes, because I wanted people to be able to pass the arguments in as function(@args), but maybe this is the way to go. Or maybe I just won't worry about it. Thanks. --Dks -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]