Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Substitution of a particular letter in all combinations of positions in word (see inside)

by LanX (Canon)
on Jan 09, 2013 at 13:08 UTC ( #1012479=note: print w/ replies, xml ) Need Help??


in reply to Substitution of a particular letter in all combinations of positions in word (see inside)

DB<182> $s=join '{e,a}',split /e/,"ferber" => "f{e,a}rb{e,a}r" DB<183> @a=< $s > => ("ferber", "ferbar", "farber", "farbar")

UPDATE

one-liner

DB<192> @a=glob(join '{e,a}',split /e/,"ferber") => ("ferber", "ferbar", "farber", "farbar")

Cheers Rolf


Comment on Re: Substitution of a particular letter in all combinations of positions in word (see inside)
Select or Download Code
Replies are listed 'Best First'.
Re^2: Substitution of a particular letter in all combinations of positions in word (see inside)
by AnomalousMonk (Abbot) on Jan 09, 2013 at 14:39 UTC

    ... and using the  /r substitution modifier of 5.14+:

    >perl -wMstrict -le "printf qq{'$_' } for glob('ferber' =~ s{e}{{e,a}}xmsgr); " 'ferber' 'ferbar' 'farber' 'farbar'
Re^2: Substitution of a particular letter in all combinations of positions in word (see inside)
by Doctrin (Beadle) on Jan 09, 2013 at 13:17 UTC
    Amazing! Thank you very much

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (13)
As of 2015-07-29 18:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (267 votes), past polls