madbee has asked for the wisdom of the Perl Monks concerning the following question:
Hello - Perl newbie here looking for some help in string manipulation! I have a String which can either be with the "-" or without that character. String is: "This is a design-controlled string". (OR) "This is a design controlled string"; In either case, I have to extract the word "design" if Controlled is found. To determine if Controlled exists, I have the below. So, inside the IF,I'm thinking this is what I need to do.
if ($title_ele =~ m/controlled/i) {
Is this the right approach? If so, how can I implement it using Perl? Alternately, is there an easier way that I can extract the word "design" from a string if "controlled" exists? Thanks much in advance, madbee
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Search and Extract from String
by Laurent_R (Canon) on Jun 29, 2013 at 09:38 UTC | |
by madbee (Acolyte) on Jun 29, 2013 at 13:18 UTC | |
|
Re: Search and Extract from String
by hdb (Monsignor) on Jun 29, 2013 at 08:25 UTC | |
|
Re: Search and Extract from String
by poj (Abbot) on Jun 29, 2013 at 08:50 UTC | |
|
Re: Search and Extract from String
by 2teez (Vicar) on Jun 29, 2013 at 08:50 UTC | |
|
Re: Search and Extract from String
by ww (Archbishop) on Jun 29, 2013 at 15:18 UTC |