my $vec = pdl [1,2,0,0,4,0]; my $nz = $vec->which; print $nz;