Perl Monk, Perl Meditation | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Not sure what your problem is with this, but you might find the following code a little cleaner:
Other than needless duplication, your code is fine. My only concern would be the &subname syntax. When calling a sub with and ampersand prefix and not passing any arguments, the current value of @_ is passed to the sub. This is useful if you are calling subs from subs and need to keep the original passed parameters. The danger is, if you're not aware of this and you have something in your @_ array, calling a sub this way may generate unexpected results. You're calling many subs with this syntax and if any of them are doing something unusual if the @_ array is empty, you may have a problem. Here's an example: Guess what? It prints "We're having an argument: Good." even though casual examination suggests that no argument was passed. It's safer to call the sub as subname() or simply call it with a bare subname (which I wouldn't suggest as that means you aren't using strict. Other than that, nothing more to offer. Give us more detail on your problem and we'll try to help.
Cheers, In reply to (Ovid) Re: is this correct?
by Ovid
|
|