#!/usr/local/bin/perl -w use strict; my @x; $_="blah"; for my $i (0..length($_)-2) { $x[$i]=substr($_,$i,1).substr($_,$i+1,1); } print "@x\n";