#!/usr/bin/perl use strict; use warnings; my $string = 'abcdefghijklmnopqrstuvwxzy0'; while($string =~ s/(...)//) {    print "$1\n"; }