sub runcode { my @ret; while (@_) { my ($x, $c) = (shift, 1); $c++, shift while $_[0] eq $x; push @ret, "$c*$x"; } return @ret; }