Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Splitting a string

by LucaPette (Friar)
on Feb 08, 2006 at 15:56 UTC ( #528828=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://528828]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (4)
As of 2022-01-17 10:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:












    Results (51 votes). Check out past polls.

    Notices?