Here's another way to do it if all the false values are just zero:
my $size = @array; @array = grep {$_} @array; unshift @array, (0) x ($size - @array);
In reply to Re: move all 0s in an array to the beginning keeping other elements order same
by SuicideJunkie
in thread move all 0s in an array to the beginning keeping other elements order same
by anilmwr
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |