Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Name "main::a" used only once: possible typo

by mithaldu (Monk)
on Mar 11, 2013 at 13:23 UTC ( #1022794=note: print w/ replies, xml ) Need Help??


in reply to Name "main::a" used only once: possible typo

I am confused that nobody suggested:

print reduce { $_[0] * $_[1] } 1..6;


Comment on Re: Name "main::a" used only once: possible typo
Download Code
Replies are listed 'Best First'.
Re^2: Name "main::a" used only once: possible typo
by toolic (Bishop) on Mar 11, 2013 at 13:38 UTC
    Perhaps because it produces the incorrect result and 8 more warning messages:
    #!/usr/bin/env perl use warnings; use strict; use List::Util qw/reduce/; print reduce { $_[0] * $_[1] } 1..6; __END__ Use of uninitialized value in multiplication (*) at x.pl line 7. Use of uninitialized value in multiplication (*) at x.pl line 7. Use of uninitialized value in multiplication (*) at x.pl line 7. Use of uninitialized value in multiplication (*) at x.pl line 7. Use of uninitialized value in multiplication (*) at x.pl line 7. Use of uninitialized value in multiplication (*) at x.pl line 7. Use of uninitialized value in multiplication (*) at x.pl line 7. Use of uninitialized value in multiplication (*) at x.pl line 7. Use of uninitialized value in multiplication (*) at x.pl line 7. Use of uninitialized value in multiplication (*) at x.pl line 7. 0
Re^2: Name "main::a" used only once: possible typo
by LanX (Canon) on Mar 11, 2013 at 13:40 UTC
    cause it doesn't work?

    use List::Util qw/reduce/; print reduce { $_[0] * $_[1] } 1..6; __END__ Use of uninitialized value in multiplication (*) at /home/lanx/B/PL/PM +/ScopeListUtils.pl line 23. ...

    Cheers Rolf

      Well damn. I was sure i had used that on List::Util stuff to get around $a/b warnings. Guess i misremembered.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (8)
As of 2015-07-29 03:41 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 (260 votes), past polls