perl -e ' my @a=(1,1,1,1,1,1,1,1); $i=0; for my $id(@a){ print $i; $i++; } ' outputs 01234567