# substr no good, this is a simplified regexp while( ($b, $c) = $a =~ /(.)(.)/g ){ #do stuff } #### $p = pos($a) ? 1 : 0;