Hi all...newbie here desperately needing to sort ... and suffering badly...
#!/usr/bin/perl -w use strict; use Lingua::EN::NameCase qw( nc ); #Where the files are located... my $Location = 'z:/bpermits/data2007/test/marchpermits.txt';<br> my $OutFile = 'z:/bpermits/data2007/test/output.txt'; #Open the files...... open(PERMSIN, $Location) or die "unable to open $Location: $!"; open(OUT, ">$OutFile") or die "unable to open $OutFile: $!"; #Read in the file, using a loop........ my @columns = qw( Permit_Number Street_Number Street_Prefix Street_Nam +e Street_Suffix Lot Block Issue_Date Proposed_Use_Code Permission_To_Code Square +_Feet Estimated_Cost Units Subdivision Zoning Contractor_Name Contractor_Add1 Contractor_Add2 Contractor_C +ity Contractor_State Contractor_Zip Contractor_Phone1 Contractor_Phone2 Owner_Name Owner_Add1 Owner_Add2 Owner_City Owner_State Owne +r_Zip Owner_Phone ); while( my $line = <PERMSIN> ) { chomp( $line ); # populate the hash %thisrecord with the column names and the valu +es from this line my @fields = split( /,/, $line ); my %thisrecord = map { $columns[$_] => $fields[$_] } ( 0 .. $#fiel +ds ); my @data = (); push @data, \%thisrecord; }
I just have no idea where to go from here.... I know I need the following line at some point, but don't know where...
sort { $b->{ Estimated_Cost } <=> $a->{ Estimated_Cost } } @data;

In reply to Help with sort.... by skins96

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.