Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Name "main::a" used only once: possible typo (limitations of "sort" like functions)

by LanX (Canon)
on Mar 05, 2013 at 21:57 UTC ( #1021906=note: print w/ replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    use List::Util qw/reduce/;
    # my ($a,$b)=(0,0);
    print reduce { $b+=$a } 1..10;
    
  2. or download this
    use warnings;
    use strict;
    ...
    
    use Data::Dump;
    dd \@x; 
    
  3. or download this
    my ($a,$b)=(0,0);
    print sort { $b cmp $a } 1..10;
    
  4. or download this
    Can't use "my $b" in sort comparison at ... line 2.
    
  5. or download this
    use warnings;
    use strict;
    ...
    package Tst;
    
    print sort { $b cmp $a } 1..10;
    
  6. or download this
    Use of uninitialized value $b in string comparison (cmp) at /home/lanx
    +/B/PL/PM/ScopeListUtils.pl line 9.
    Use of uninitialized value $a in string comparison (cmp) at /home/lanx
    +/B/PL/PM/ScopeListUtils.pl line 9.
    Use of uninitialized value $b in string comparison (cmp) at /home/lanx
    +/B/PL/PM/ScopeListUtils.pl line 9.
    Use of uninitialized value $a in string comparison (cmp) at /home/lanx
    +/B/PL/PM/ScopeListUtils.pl line 9.
    ...
    

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (6)
As of 2014-08-28 04:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (256 votes), past polls