Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Is there any way to ignore certain words and keep it as it is when substituing hash values to a matched pattern in a string?

by skooma (Novice)
on Apr 02, 2018 at 09:04 UTC ( [id://1212142]=perlquestion: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    my $texttosub = "log10(blackcat)";
    #the value of "blackcat" can be found in a hash called "%cats"
    ...
      ..do something..
    }
    sub log10{....}
    
  2. or download this
     while ( $texttosub =~ s/(?!log10)|([a-zA-Z][A-Za-z_0-9]+)/$cats{$1}/i
    + ){
       ..do something..
      }
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (2)
As of 2024-04-26 04:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found