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;

Replies are listed 'Best First'.
Re^2: Splitting a string
by ikegami (Patriarch) on Feb 08, 2006 at 17:19 UTC

    Incorrect. It returns
    pe er rl lm mo on nk ks
    instead of
    pe er rl mo on nk ks