in reply to puzzled by pos
"hello world!" is 12 characters long, and it works fine. Removing the bang at the end, it becomes 11 and the normal loop will fail.#!/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__ <h:e> <l:l> <o: > <w:o> <r:l> <d:>
_ _ _ _ (_|| | |(_|>< _|
|
|---|