Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: swap columns in a 2-dim array

by tlm (Prior)
on Jun 17, 2005 at 08:59 UTC ( #467623=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    sub fys {
        my $arr = shift;
    ...
            --$i;
        }
    }
    
  2. or download this
    @nums = map [ @{$_}[@cols] ], @nums;
    
  3. or download this
    my @cols = 0..11;
    do {
      fys( \@cols );
    } until is_deranged( \@cols );
    
  4. or download this
    sub is_deranged {
      my $arr = shift;
      $arr->[ $_ ] == $_ and return for 0..$#$arr;
      return 1;
    }
    
  5. or download this
    use strict;
    use warnings;
    ...
            @$arr[$i,$j] = @$arr[$j,$i];
        }
    }
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://467623]
help
Chatterbox?
[Corion]: Hmmm... Weird. Maybe it needs that for doing its timers or something. Still weird.
[Corion]: But I guess I'll find out soonish, as my application seems to use Prima for more than just displaying the OpenGL output soonish ;))
[ambrus]: No, I think the timers are handled fine in the event loop, as far as I can see.
[Corion]: So far, I liked Prima quite well as it simply seems to do what I want even if it has an upside-down coordinate system. But it installs from CPAN out of the box and is cross-platform

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (6)
As of 2016-12-09 10:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (150 votes). Check out past polls.