http://qs321.pair.com?node_id=1230873


in reply to Python tricks

The matrix transposition can be done as a one-liner if you use PDL:

Done on Strawberry Perl 5.26.1 perl -MPDL -e "$seq = sequence(3,2)+1; print transpose( $seq );"
Edit: even better is:
perl -MPDL -e "print transpose(sequence(3,2)+1);"
The nested function calls appeal to my Lispy side; but in Perl, it is often easier for me to assign something to a variable, then pass that variable to a function/subroutine. My matrix algebra is very rusty, but I suppose some of the other matrix problems have 1 line solutions using PDL. I will come back to this.