On Jun 17, Lonya said:

>Say I have a line like this:
>This *s a te*t, this *s only a te*t.
>
>And I'd like to replace "te*t," with "test," after a dictionary lookup.
>Well, I can split out the punctuation easily enough, but I don't know
>how to join it back in later.

You probably want to use a regex, instead of split().

  $string =~ s/([\w*]+)/replace($1)/eg;

where replace() is your function for changing "te*t" into "test" or
"text" or "tent", etc.

-- 
Jeff "japhy" Pinyan      [EMAIL PROTECTED]      http://www.pobox.com/~japhy/
I am Marillion, the wielder of Ringril, known as Hesinaur, the Winter-Sun.
Are you a Monk?  http://www.perlmonks.com/     http://forums.perlguru.com/
Perl Programmer at RiskMetrics Group, Inc.     http://www.riskmetrics.com/
Acacia Fraternity, Rensselaer Chapter.         Brother #734
**      Manning Publications, Co, is publishing my Perl Regex book      **

Reply via email to