G
gamo
Hello, I have a 2D array and want to interchange rows and columns.
I have done this test and it fails talking about flips and flops.
The perldoc -f splice is not of much help to swap 2 rows in a 2D
array (4 parameters as argument).
#!/usr/local/bin/perl -W
for $x (0,1){
for $y (0,1){
$xy[$x][$y]= ++$count;
}
}
splice @xy, 0, 1, $xy[1][0..1];
for $x (0,1){
for $y (0,1){
print "$xy[$x][$y] ";
}
print "\n";
}
__END__
Thanks in advance for any help
I have done this test and it fails talking about flips and flops.
The perldoc -f splice is not of much help to swap 2 rows in a 2D
array (4 parameters as argument).
#!/usr/local/bin/perl -W
for $x (0,1){
for $y (0,1){
$xy[$x][$y]= ++$count;
}
}
splice @xy, 0, 1, $xy[1][0..1];
for $x (0,1){
for $y (0,1){
print "$xy[$x][$y] ";
}
print "\n";
}
__END__
Thanks in advance for any help