Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
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;

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 (Chancellor) 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 all is quiet...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (2)
As of 2016-12-11 14:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (169 votes). Check out past polls.