Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9153441
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T12:16:23+00:00 2026-06-17T12:16:23+00:00

I have an array in perl that contains about 200 indexes that are for

  • 0

I have an array in perl that contains about 200 indexes that are for a csv file. It likes like the lines below:

46.9234784633993,Springwood Drive,Naples,FL
89.7786182217159,W 8th St,Lakeland,FL

I want to sort them by that number before the first comma. I tried using just sort, but sometimes the numbers get into the hundreds and thousands and it just sorts all those in the 1’s. Then a numerical sort doesnt like it since they are not numerical entries

I tried this

my @sortedDistances = sort{ $a <=> $b }(@completedDistances);
and
my @sortedDistances = sort(@completedDistances);
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T12:16:24+00:00Added an answer on June 17, 2026 at 12:16 pm

    This is a possible solution, try if it works:

    open FILE, "<", $ARGV[0] or die $!;
    my @sorted =
        map { join ",", @{$_} }
        sort { $a->[0] <=> $b->[0] }
        map { [ split /,/ ] } <FILE>;
    close FILE;
    say join "\n", @sorted;
    

    EDIT: changed colon to comma

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a .plist file that looks like this: <plist version=1.0> <array> <dict> <key>name</key>
I have a Perl array of URLs that all contain http://. I'd like to
I have some perl code that looks something like this: my @array = map
I have a Perl subroutine which returns an array of vaules, and I'd like
If I have a hash in Perl that contains complete and sequential integer mappings
I have an array that contains string which may contain whitespaces appended to the
Okay, so I'm using perl to read in a file that contains some general
I have a Moose class that i would like to store using Apache::Session::File. However,
I have a perl script that writes out an array filled with integers to
If I have an array and hash like these #!/usr/bin/perl use warnings; use strict;

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.