Hi All
I made a simple solution would like to share with all. also forget to share
that every array would have 16 entries,

considering my previous hash name is %MAIO_CH_GROUP

my @total_array;
foreach my $key (sort keys %MAIO_CH_GROUP) {
            print "KEY=[$key]--VALUE=[@{$MAIO_CH_GROUP{$key}}]\n";
            push (@total_array,@{$MAIO_CH_GROUP{$key}});
        }
        print "TOTAL_ARRAY=[@total_array]\n";
        for (my $j=0;$j<=15;$j++) {
            my $counter = $j;
            my @tmp_array;
            for(my $k=0;$k<=15;$k++) {
                my $element = $total_array[$counter];
                push(@tmp_array,$element);
                $counter = $counter +16;
            }
            print "TMP_ARRAY=[@tmp_array]\n";
        }

On Wed, Jun 17, 2015 at 11:25 PM, Jim Gibson <j...@gibson.org> wrote:

> It seems that you are working with a two-dimensional array of numbers, so
> it is not clear why you are using a hash to store this data instead of an
> array of arrays.
>
> What you seem to be asking for is to generate the transpose of the
> two-dimensional array. So the simplest approach would be to convert your
> hash into an array of arrays and calculate the transponse. Does that work
> for you?
>
> > On Jun 17, 2015, at 10:48 AM, Anirban Adhikary <
> anirban.adhik...@gmail.com> wrote:
> >
> > Hi List
> >
> > I have a hash with the following data structure.
> > KEY=[0]--  VALUE=[57 147 237 327 417 507 597 687 777 867 957 1047 1137
> 1227 1317 1407]
> > KEY=[1]--  VALUE=[58 148 238 328 418 508 598 688 778 868 958 1048 1138
> 1228 1318 1408]
> > KEY=[10]--VALUE=[67 157 247 337 427 517 607 697 787 877 967 1057 1147
> 1237 1327 1417]
> > …
>
> > Now you can see that for first key i.e. KEY 0 the values are from 57 to
> 1407. But my target is to create another hash whose first key will be KEY0
> but its value will be from 57 to 66 that means for each value each column
> will be changed as each row.
> >
> > How to implement this. Please provide some hints.
> >
> > Best Regards
> > Anirban.
> >
>
>
> --
> To unsubscribe, e-mail: beginners-unsubscr...@perl.org
> For additional commands, e-mail: beginners-h...@perl.org
> http://learn.perl.org/
>
>
>

Reply via email to