Help for this page

Select Code to Download


  1. or download this
    use Iterator;
    
    my $i = 0;
    ...
    print "Before calling anything: $i\n";
    print "First call yields: ", $iterator->value, "\n";
    print "After first call: $i\n";
    
  2. or download this
    Before calling anything: 0
    First call yields: 1
    After first call: 1
    
  3. or download this
    Before calling anything: 1
    First call yields: 1
    After first call: 2
    
  4. or download this
    use Iterator;
    
    my $i = 0;
    ...
    print "Got b ($i)\n";
    print "First value is ($i):\n";
    print "b: ", $b->value, " ($i)\n";
    
  5. or download this
    Now I will get_b (0):
    Got b (0)
    First value is (0):
    b called
    a called
    b: 0 (1)
    
  6. or download this
    Now I will get_b (0):
    a called
    b called
    ...
    b called
    a called
    b: 0 (3)