Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

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

by three18ti (Monk)
on Nov 03, 2013 at 01:08 UTC ( [id://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.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (4)
As of 2024-04-24 03:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found