Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re^2: [HOP] Working with Iterators, why do I suddenly get a coderef?

by three18ti (Scribe)
on Nov 03, 2013 at 01:08 UTC ( #1061003=note: print w/ replies, xml ) Need Help??


in reply to Re: [HOP] Working with Iterators, why do I suddenly get a coderef?
in thread [Solved][HOP] Working with Iterators, why do I suddenly get a coderef?

Hello,

Thanks for your reply. Interestingly, I'm not getting a different result when adding parenthisis for the append() call, but when I use parenthesis for the call to list_iterator, it DOES fix my problem.

my $it3 = append (upto(1,3), list_iterator qw(foo bar baz), upto (7,9) +); print_it $it3;

prints:

Invalid append 1 $VAR1 = 1; $VAR1 = 2; $VAR1 = 3; $VAR1 = 'foo'; $VAR1 = 'bar'; $VAR1 = 'baz'; $VAR1 = sub { use warnings; use strict 'refs'; return $start <= $end ? $start++ : undef; };

But when I use parenthesis around list_iterator:

print "\n\nInvalid append 1\n"; my $it3 = append upto(1,3), list_iterator (qw(foo bar baz)), upto (7,9 +); print_it $it3;

I get what I would expect

Invalid append 1 $VAR1 = 1; $VAR1 = 2; $VAR1 = 3; $VAR1 = 'foo'; $VAR1 = 'bar'; $VAR1 = 'baz'; $VAR1 = 7; $VAR1 = 8; $VAR1 = 9;

Thanks for the assist! I think the problem is trying to make too many calls to subs without parenthesis.


Comment on Re^2: [HOP] Working with Iterators, why do I suddenly get a coderef?
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1061003]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (8)
As of 2015-07-30 08:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (270 votes), past polls