in reply to Re: Re (tilly) 2: Comprehending Binary :=
in thread Comprehending Binary :=
Hey! That's an important achievement. ;-)
But, of course, there are many other uses for binding too (some of which have already been mentioned in this thread). Here's another that hasn't been mentioned yet. Binding is particularly useful when you have lvalue subroutines/methods and you want to do something complex with the lvalue. Rather than repeatedly calling the subroutine/method:
while (<>) { $obj.threshold += $_ unless $obj.threshold > $min; }
you can just bind the lvalue once and use the bound variable instead:
my $thresh := $obj.threshold; while (<>) { $thresh += $_ unless $thresh > $min; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
(MeowChow) Re6: Comprehending Binary :=
by MeowChow (Vicar) on Oct 08, 2001 at 07:58 UTC | |
by TheDamian (Vicar) on Oct 08, 2001 at 08:06 UTC | |
by MeowChow (Vicar) on Oct 08, 2001 at 08:16 UTC | |
by chromatic (Archbishop) on Oct 08, 2001 at 08:54 UTC | |
by TheDamian (Vicar) on Oct 08, 2001 at 11:22 UTC |