Revision: | 1.5 |
Committed: | Mon Jul 23 22:27:42 2001 UTC (23 years, 1 month ago) by root |
Branch: | MAIN |
CVS Tags: | rel-3_55, rel-3_51, rel-3_11, rel-1_31, rel-3_5, rel-3_4, rel-3_3, rel-3_501, rel-3_1, rel-3_0, rel-2_5, rel-2_0, rel-2_1, rel-1_0, rel-1_9, rel-1_1, stack_sharing, rel-1_2, rel-1_5, rel-1_4, rel-1_7, rel-1_6, rel-3_41, rel-3_01, rel-3_2 |
Changes since 1.4: | +3 -3 lines |
Log Message: | *** empty log message *** |
# | Content |
---|---|
1 | #!/usr/bin/perl |
2 | |
3 | use Coro; |
4 | use Coro::Cont; |
5 | |
6 | sub mul23 : Cont { |
7 | yield 2*shift; |
8 | yield 3*shift; |
9 | } |
10 | |
11 | my %hash = (1,10,2,20,3,30); |
12 | |
13 | %hash = map mul23($_), %hash; |
14 | |
15 | print join(",", %hash), "\n"; |
16 | |
17 | # here is a random-number generator |
18 | |
19 | sub badrand : Cont { |
20 | my $seed = 1; |
21 | while() { |
22 | $seed = $seed * 121 % 97; |
23 | yield $seed % $_[0]; |
24 | } |
25 | } |
26 | |
27 | print badrand($_), " " for 1..30; print "\n"; |