in reply to finding number of contiguous letters

The lamest of all, but what the heck. :)
$word = 'computer';
my @results;
while ($word) {
        $word =~ /(...)/;
        push @results, $1;
        $word =~ s/^.//;
}
print "@results";
  • Comment on Re: finding number of contiguous letters

Replies are listed 'Best First'.
Re^2: finding number of contiguous letters
by blazar (Canon) on May 23, 2007 at 20:53 UTC
    $word =~ /(...)/; push @results, $1;

    Well, lame is lame, but to make it just a little less so, I would at least

    $word =~ /(...)/ and push @results, $1;