use Pointy::Counter; my $i = counter; while ($i --> 10) { print "Counter is $i\n"; }
This achieved via some fairly basic (albeit unintuitive) use of overloading. See https://metacpan.org/release/TOBYINK/Pointy-Counter-0.001.
I really need to investigate here to see how feasible it would be to achieve syntax like this:
use Pointy::Counter; while (ctr $i --> 10) { print "Counter is $i\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: pointy counters
by choroba (Cardinal) on Dec 22, 2011 at 09:32 UTC | |
|
Re: pointy counters
by keszler (Priest) on Dec 20, 2011 at 23:35 UTC | |
|
Re: pointy counters
by jffry (Hermit) on Dec 20, 2011 at 23:38 UTC | |
by tobyink (Canon) on Dec 21, 2011 at 10:55 UTC | |
by Anonymous Monk on Dec 20, 2011 at 23:50 UTC | |
|
Re: pointy counters
by choroba (Cardinal) on Dec 21, 2011 at 08:39 UTC | |
by tobyink (Canon) on Dec 21, 2011 at 10:18 UTC | |
by Discipulus (Canon) on Dec 21, 2011 at 17:15 UTC | |
by GotToBTru (Prior) on Dec 29, 2011 at 18:39 UTC |