is constant (default)

        Every formal parameter is constant by default, meaning primarily
        that the compiler won't feel obligated to construct an lvalue
        out the actual argument unless you specifically tell it to. It
        also means that you may not modify the parameter variable in any
        way. If the parameter is a reference, you may use it to modify
        the referenced object (if the object lets you), but you can't
        assign to it and change the original variable passed to the
        routine.

this confuses me. sometimes i want a simple pass by value param which i
can modify locally in the sub. is this the same as the constant above?
if so the name is not the best (even if it is the default and won't be
explicitly used much).

editing suggestion for last sentence:

        If the parameter is a reference, you may use it to modify the
        referenced object (if the object lets you). If you assign to a
        constant param, its value will change inside the sub (like any
        other lexical variable would) but the original variable passed
        to the routine is never modified. This behavior is well known as
        pass by value.

uri

-- 
Uri Guttman  ------  [EMAIL PROTECTED]  -------- http://www.stemsystems.com
----- Stem and Perl Development, Systems Architecture, Design and Coding ----
Search or Offer Perl Jobs  ----------------------------  http://jobs.perl.org
Damian Conway Perl Classes - January 2003 -- http://www.stemsystems.com/class

Reply via email to