Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
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
Re^2: Name "main::a" used only once: possible typo
by toolic (Chancellor) 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 musing on the Monastery: (2)
As of 2014-09-17 02:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (56 votes), past polls