Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

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

by LanX (Saint)
on Mar 05, 2013 at 21:57 UTC ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1021906]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (5)
As of 2024-04-19 22:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found