jimston...@aol.com wrote:

can anyone give me some help on a perl program to change a file of  mine.
The string is:

$_ = "from ''alam' (481) or possibly  (in the sense of dumbness);
solitary; Ulam, the (6155) name of two Soldiers;--Ulam."

Where each line is $_
I'm trying to substitute a hyperlink for each  NUMBER that is in
parenthesis only, while not touching the words in parenthesis  or any other 
numbers.
For example, I want to change (481) in the line above  to
(<href="mypage.php?481">481</a>) and (6155) to  
(<href="mypage.php?6155">6155</a>) and any
others without changing  anything in (in the sense of dumbness).

s/\((\d+)\)/(<a href="mypage.php?$1">$1</a>)/g;



John
--
Any intelligent fool can make things bigger and
more complex... It takes a touch of genius -
and a lot of courage to move in the opposite
direction.                   -- Albert Einstein

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to