http://www.perlmonks.org?node_id=528828


in reply to Splitting a string

My code is untested but works with your example...
#!/usr/bin/perl use strict; use Data::Dumper; my $string='perl monks'; my @p=grep { m/[a-z]/i } split //,$string; @p=map { "$p[$_]$p[$_+1]" } 0..$#p-1; print Dumper \@p;