Re: general subroutine question
Derek B. Smith wrote:
Is there a commonly known way or method to limit the
number of arguments that a subroutine can store or
pass?
First, don't use prototypes. Even if that's what they were designed
for, eventually they'll break your code.
use Carp;
sub only3 {
croak "only3 called with too many arguments" if @_ > 3;
#do whatever you need to with @_
}
Paul Lalli
.
Relevant Pages
- My Johnny Smith Story
... We arrived at the store and she had to make me get out of the car. ... I could see what looked exactly like the album cover. ... to know it was Johnny Smith. ... He did....and I didn't change those strings for years. ... (rec.music.makers.guitar.jazz) - Re: My Johnny Smith Story
... She talked me into stopping at his music store in Colorado ... > I could see what looked exactly like the album cover. ... to know it was Johnny Smith. ... > show me a few things on the guitar. ... (rec.music.makers.guitar.jazz) - Re: subroutine definitions
... >> with much greater clarity. ... A '$' in the subroutine prototype means a scalar, ... > it will be passed to the subroutine as an array reference. ... Perl prototypes strikes me as primarily a seed of confusion. ... (perl.beginners) - Re: Banned From Wal-Mart (satire & parody)
... After Mr. and Mrs. Smith retired, ... forced to ban both of you from the store. ... When a clerk asked if they could help him he began crying ... Darted around the store suspiciously while loudly humming ... (rec.arts.mystery) - Banned From Wal-Mart (satire & parody)
... This is why women should not take men shopping against their will. ... After Mr. and Mrs. Smith retired, ... your husband has been causing quite a commotion ... forced to ban both of you from the store. ... (rec.arts.mystery) |
|