package Tie::Transpose; use strict; use warnings; sub TIEHASH {bless $_ [1] => $_ [0]} sub FETCH {my ($y, $x) = split /$;/ => $_ [1]; $_ [0] [$x] [$y]} sub STORE {die} package main; my $matrix = [[qw /ab cd ef/], [qw /gh ij kl/], [qw /mn op qr/], [qw /st uv wx/]]; tie my %trans => 'Tie::Transpose', $matrix; print $trans {0, 0}, "\n"; print $trans {0, 1}, "\n"; print $trans {0, 2}, "\n"; print $trans {0, 3}, "\n"; __END__ ab gh mn st