Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • my $array = Array::AsHash->new({array => [qw/foo bar one 1 two 2/]});

    while (my ($k, $v) = $array->each) {
      print "Starting loop\n" if $array->first;
      print "Key is $k.  Value is $v\n";
      print "Ending loop\n"   if $array->last;

    That makes me think Adrian [] was right that the iterator should be factored out.

    Nice work, in any case. I think I can think of a script or two which would have been nicer to write with code like that. Perl’s builtin data types are powerful, but things get really fiddly if you need something more than they can express natively.

    • I'm need to do some more work on this module today. I think I will look into the iterator.