Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re^2: sorting array of arrays

by fanasy (Sexton)
on Jan 20, 2020 at 03:33 UTC ( #11111619=note: print w/replies, xml ) Need Help??


in reply to Re: sorting array of arrays
in thread sorting array of arrays

you miss "->"
use strict; use warnings; ;; my @ar = ([1,12],[8,3],[4,57],[22,5]); my @sort = sort{$a->[1]<=>$b->[1]}@ar; foreach (@sort){ print "@$_\n";}

PS D:\perl\perlmonks> perl .\sort.pl
8 3
22 5
1 12
4 57

Replies are listed 'Best First'.
Re^3: sorting array of arrays
by AnomalousMonk (Bishop) on Jan 20, 2020 at 04:43 UTC

    But the point of my post and part of the point of hippo's before it is that if warnings and/or strict had been used, Perl would not have, so to speak, "missed" the  -> operator.

    Update: Oh... Or did you mean to respond to the OP?


    Give a man a fish:  <%-{-{-{-<

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (3)
As of 2020-09-27 14:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    If at first I donít succeed, I Ö










    Results (142 votes). Check out past polls.

    Notices?