Hi,

I was asked by a friend to write a one-linear to add a character every 2 
characters.  For example:
"For example" Will become "Fo#r #ex#am#pl#e"

I tried to do it with join and split (seems natural for me), but had no 
success, I managed to do it only with map:
map({s/(..)/$1#/g,$_}$_)

The best I got from join and split is :
join ("#" , split (/(..)/, $_))
which prints 2 #  after each 2 characters. I understand why, but I could not 
get rid of it.

Any ideas ?

Yossi



_______________________________________________
Perl mailing list
[email protected]
http://perl.org.il/mailman/listinfo/perl

Reply via email to