in reply to Re^2: Mixed lvalue/rvalue sub function
in thread Mixed lvalue/rvalue sub function

Ah, yes, you are of course completely right, I guess I did too much C++ recently :)

Alternatively you could return a reference to the header, of course. But it would look kinda more ugly than the simple optional argument solution:

my $slot = $self->header ('test'); $$slot = "New value"; print "Value for header: $$slot"; # or even $slot, if you overload the + stringification

Replies are listed 'Best First'.
Re^4: Mixed lvalue/rvalue sub function
by mscharrer (Hermit) on Apr 18, 2008 at 17:18 UTC
    If you like to start using lvalue function, you should know that they are still marked as experimental (at least in Perl 5.8).

    perlsub says:

    WARNING: Lvalue subroutines are still experimental and the implementation may change in future versions of Perl.