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

Re: In-place sort with order assignment

by changma_ha (Sexton)
on Sep 20, 2010 at 04:48 UTC ( #860761=note: print w/replies, xml ) Need Help??


in reply to In-place sort with order assignment

Hi BrowseUk.....I tried to solve your problem....may be i didn't get the the result exactly as u wanted....i hope my code will help you.

#! /usr/bin/perl use strict; use warnings; use Data::Dumper; my $count= 0; my $i; my %hash=( A=> [], B=> [], C=> [], ); foreach my $key (sort keys %hash){ $count++; for ($i=1;$i<=$count;$i++){ $hash{$key} =$i; } print Dumper \%hash; }

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (5)
As of 2022-09-25 15:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I prefer my indexes to start at:




    Results (116 votes). Check out past polls.

    Notices?