my $foo = 'HelloWorld!'; my @bar; do { chop $foo; push @bar, length $foo } while ($foo); pop @bar; @bar = reverse @bar; @bar;