Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Eliminating "used only once" warnings from List::Util::reduce

by davido (Cardinal)
on Jul 30, 2013 at 00:37 UTC ( [id://1046932]=perlquestion: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    use warnings;
    use List::Util;
    my $reduced = List::Util::reduce { $a + $b } 1, 2, 3, 4;
    print "$reduced\n";
    
  2. or download this
    Name "main::a" used only once: possible typo at mytest.pl line 3.
    Name "main::b" used only once: possible typo at mytest.pl line 3.
    10
    
  3. or download this
    use warnings;
    my @sorted = sort { $a <=> $b } 1, 2, 3, 4;
    print "@sorted\n";
    
  4. or download this
    1 2 3 4
    
  5. or download this
    STATIC void
    S_simplify_sort(pTHX_ OP *o)
    ...
        GvMULTI_on(gv_fetchpvs("a", GV_ADD|GV_NOTQUAL, SVt_PV));
        GvMULTI_on(gv_fetchpvs("b", GV_ADD|GV_NOTQUAL, SVt_PV));
        ...
    
  6. or download this
    void
    reduce(block,...)
    ...
        agv = gv_fetchpv("a", GV_ADD, SVt_PV);
        bgv = gv_fetchpv("b", GV_ADD, SVt_PV);
        ...
    
  7. or download this
    agv = gv_fetchpv("a", GV_ADD, SVt_PV);
    GvMULTI_on(agv); /* No apparent effect. */
    
    agv = gv_fetchpv("a", GV_ADD|GV_ADDMULTI, SVt_PV); /* Nope */
    agv = gv_fetchpv("a", GV_ADDMULTI, SVt_PV); /* *sigh* No. */
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://1046932]
Front-paged by ww
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (8)
As of 2024-04-23 08:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found