Rob Dixon wrote: > R. Joseph Newton wrote: > > > > l Maldonado Torres wrote: > > > > > > > > I am trying to use prototype functions with object but this seems not > > > to work, I mean perl does not check for the type of arguments. > > > > > > I usually do this. > > > > > > sub array_print(\@); > > > ...sub array_print(\@) > > > ... > > > > Your immediate problem here is that you are trying to use an expression as a > > formal argument. Formal arguments in Perl can only take storage types. Really, > > the only meaningful ones are scalar and list. The list, if it is present, must > > be the last parameter, and there can only be one, since any list will consume > > all arguments offered from there on. > > > > The formal parmeter expressions you show are both array references. These are > > scalars. They should be prtotyped as $. > > Sorry Joseph. This from perldoc perlsub > > Prototypes > > Perl supports a very limited kind of compile-time argument checking > using function prototyping. If you declare > > sub mypush (\@@) > > then "mypush()" takes arguments exactly like "push()" does. > > Cheers, > > Rob
Thanks, Rob, That information actually makes prototypes at least marginally more useful. If you can specify the type to which a references refers, that certainly offers more information than the simplescalar and list types I have seen. It also provides a way to set up more complicatedparameters lists and still use prototypes. Joseph -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>