Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: conditional statement in substitution expression

by Roy Johnson (Monsignor)
on Aug 04, 2009 at 17:16 UTC ( #785837=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
      s/\*\*([^\*]+)\*\*\s\,\s\*\*([^\*]+)\*\*(\s\,)?/(grep {index($_,'_')
    +>=0} $1,$2)?"**$1_($2)**":$&/ge;
    
  2. or download this
    while(<DATA>) {
      s/(\*\*([^\*]+)\*\*\s\,\s\*\*([^\*]+)\*\*(\s\,)?)/(grep {index($_,'_
    +')>=0} $2,$3)?"**$2_($3)**":$1/ge; 
      print;
    }
    

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (2)
As of 2021-10-20 15:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My first memorable Perl project was:







    Results (81 votes). Check out past polls.

    Notices?