Re: general subroutine question



Derek B. Smith am Mittwoch, 30. August 2006 19:56:
All,

Is there a commonly known way or method to limit the
number of arguments that a subroutine can
store

store where?

or pass?

pass to what?


Did you mean: Is there a way for a subroutine to react to a call with to many
arguments?

sub accept_max_5_arguments {
die 'too many arguments!' if @_ > 5;
}

sub accept_max_x_arguments { # apart from the first
my $maxargs=shift;
die 'too many arguments!' if @_ > $maxargs;
}

If this does not help: Could you, long time posting list member, clarify your
question?

Dani
.



Relevant Pages

  • Re: Memory problem with XML::DOM::Parser???
    ... >> # Die Anfrage ist Teil der neuen EPA ... # Modul für die XML-Funktionen des Clients ... # Subroutine, um die XML-Struktur aus dem XML-Rootfile und den ... sub construct_xml { ...
    (comp.lang.perl.misc)
  • Re: passing database data to a sub
    ... > I'm not sure of the difference, why isn't it a subroutine? ... > sure about this 'shift' thing anyway :-) ... > sub teardown ... > # Setup the template to use for the output. ...
    (perl.beginners)
  • Re: Shared Method Problem With "Global" Storage
    ... Shared Method Problem With "Global" Storage ... declare the Sub as Shared. ... What I don't get is that if I refer to ButtonHasBeenClicked in a subroutine ... code which is unique to mining web site B. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Proper class setup?
    ... > sub init { ... here: AUTOLOAD and lvalue subroutines. ... if a subroutine named AUTOLOAD exists then it will be called whenever ...
    (perl.beginners)
  • Re: VB app nolonger works with XP SP2
    ... >> Public Sub New ... >> Private components As System.ComponentModel.IContainer ... >> ' This enumeration provides values for the lines sent to the Comm Port ... >> ' This subroutine invokes a thread to perform an asynchronous write. ...
    (microsoft.public.dotnet.languages.vb)