On 2010.06.28 20:39, jimston...@aol.com wrote: > > In a message dated 6/28/2010 7:49:47 P.M. Eastern Daylight Time, > jwkr...@shaw.ca writes: > > 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 > > ) and (6155) to (<href="mypage.php?6155">6155) and any >> others without changing anything in (in the sense of dumbness). > > s/\((\d+)\)/(_$1_ (mip://050adf60/mypage.php?$1) )/g; > > Excellent! Works perfectly. Thank you so much!
Perhaps you could post the code you originally started with, so that you/others can understand how/why John's hack works, particularly if your data ever changes. Steve -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/