Stories
Slash Boxes
Comments
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.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • I played a bit with the concept, and found an issue I can't resolve, possibly you can help me here. The problem concerns whether $_ is an alias or a copy to the parameter passed. If it is a copy then you can't modify it unless it is a reference. If it is an alias you can't modify it if it is read-only. You may ask why should it be modified at all, and here comes the classic unfoldr:

    unfoldr { $_ ? ($_, $_ - 1) : () } 10;

    10,9,8,7,6,5,4,3,2,1

    which allows to pass arbitrary values to the callback .