Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
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 cooling their heels in the Monastery: (9)
As of 2015-07-08 07:47 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 (96 votes), past polls