in reply to Subroutine as an lvalue?
That is, as far as I know, a new feature in perl 5.6.0. So first, if you don't have it, you'd better get it. How does it work? Well, this page is all I could find on it (the what's new page).
The example it gives there is this:
my $a = 10; my $b = 20; sub mysub : lvalue { if ($_[0] > 0) { return $a } else { return $b } } mysub(2) = 15; # Set $a to 15 mysub(-1) = 9; # Set $b to 9
Not too tough.
Update:I just noticed it also says "This is still an experimental feature, and may go away in the future; it's also not possible to return array or hash variables yet." so keep that in mind.
72656B636148206C72655020726568746F6E41207473754A
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
RE: Re: Subroutine as an lvalue?
by takshaka (Friar) on May 28, 2000 at 00:16 UTC | |
by mdillon (Priest) on May 28, 2000 at 00:54 UTC | |
by takshaka (Friar) on May 28, 2000 at 01:06 UTC |