Just another Perl shrine | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
The thing is, the documentation doesn't say. It would be something like this, although with a bit more gritty realism:
create(id)So, I have an array @bob = ('Bob') which I want to use on this function. Eyeballing it, it looks like it would fit, so I go ahead and use it: Foo::create(@bob);Do you get a warning? Nope. Yet later, you might notice that for some reason your Foo has an id of 1, which doesn't make any sense. Maybe smoke starts pouring out of your Perl program because of acalar conversion induced program failure. You lose a life and must hit "P1 Start" to continue. Without checking the source code you're never really going to know for sure. Conceputally, I was hoping for either a quick idiomatic way to do it, or something like one of these: Instead, you're going to have to do some work, which is anti-Lazy. In the general sense: Foo::bar($baz[0],$baz[1],$baz[2],...,$baz[$#baz]); Update: I certainly can't contest merlyn's "random crap" remark, so I'd say this was "premeditated ignorance". I knew the array had a single element and expected a particular behavior. After all, why expand twice (once on call, once on parameter import)? Well, sometimes you've just got to. In reply to Re^2: Function Prototypes and Array vs. List (Pt. 2)
by tadman
|
|