Scroll to the top

Using just javascript and no animation:
window.scrollTo(x-coord, y-coord);
that will be window.scrollTo(0,0);

Using jQuery with animation:
$(“html, body").animate({ scrollTop: 0 }, “slow");

Cross reference with scroll to elemenet post.

Just a reference for myself.


Transposing a two dimensional array using perl

sub makeTransposed {
my $a=shift;
my @rows=@{$a};
my @transposed = ();
for my $row (@rows) {
for my $column (0 .. $#{$row}) {
push(@{$transposed[$column]}, $row->[$column]);
return \@transposed;

First get the reference of the two dimensional array and then create and setup the transposed array.

One dimensional array to two with Perl

my $array2D=&make2D(\@array1D);

sub make2D {
my $a=shift;
my @array1D=@{$a};
my $maxrow=11;
my $maxcol=21;
my @matrix=();
for(my $i=0;$i<$maxrow;$i++){
@r=splice @array1D,0,$maxcol;
push @{$matrix[$i]},@r;
return \@matrix;

Using perl splice command extract the array one after another. One dimensional array will be chopped into two dimensional array now.