in reply to iterator w/ wantarray()

It would be prudent of you to at least explain what the expected results should be, and the results you're getting.

"It doesn't work as I expect" isn't helpful.

Replies are listed 'Best First'.
Re^2: iterator w/ wantarray()
by jo37 (Curate) on Apr 25, 2020 at 19:51 UTC

    What's wrong with:

    #should print 1, 4, 7

    Greetings,
    -jo

    $gryYup$d0ylprbpriprrYpkJl2xyl~rzg??P~5lp2hyl0p$

      I don't normally look for expected results in a comment at the bottom of the code. It should be expressed along with the problem statement.

      Beyond that, I don't even look at code if the OP doesn't provide a problem statement, expected, and actual results up front. Why look at code to solve a problem for someone, if they don't at least state what's expected from it clearly? I might find 30 issues to fix, but I've wasted my time if I didn't fix the one thing that was broken to them.

        Besides the phrase "in a comment", would your statement hold for an example written as a Test::More script, too?

        Greetings,
        -jo

        $gryYup$d0ylprbpriprrYpkJl2xyl~rzg??P~5lp2hyl0p$