I'm trying to sort date that looks like this:
29 '0,wupra00a0537'
30 '31,wppra00a0513'
31 '0,wupra00a0535'
32 '0,wuprd02a0089'
33 '0,wupwa07a0663'
34 '0,wdpwa00a0013'
35
my code looks like this:
my @array = ();
@array = map { $_->[0] }
sort { $b->[1] <=> $a->[1] }
map { [ $_, /.+,/ ] } @cpu_lt_40
I want to sort by the number in descending order and the sort result is (partial):
147 '0,wuprm00a0539'
148 '0,wuprm00a0539'
149 '28,wppra02a0015'
150 '24,wppra01a0016'
151 '0,wupra00a0532'
152 '15,wppra01a0015'
153 '22,wppra01a0095'
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.