#!/usr/bin/perl -w use strict; my $x="hello world"; # 11 chars while ( $x =~ /(.)(.)?/g ) { my ( $y, $z ) = ( $1, $2 ); $z = "" unless $z; # prevents the warning # "use of uninitialized ..." print"<$y:$z>\n"; } __END__