Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
For example, the following scalar may exist:
$scalar = "anyfile_[w(one|two|three|four)].txt";
Whenever the [x()] appears, I need to be able to look at the information within the brackets. Depending on the value of "x", I need to perform a specific operation with the items that appear in the "()." As of right now, I am having a hard time with the loop and the regular expression. I really need some help with this.
How do I loop through the scalar and find the [x()] and extract the "x" and "()" information? What if there are more then one [x()]?
Any help and/or advice would be greatly appreciated.
JT
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Loop Through Scalar Obtain Information With Regular Expression
by dragonchild (Archbishop) on Jul 24, 2003 at 21:38 UTC | |
|
Re: Loop Through Scalar Obtain Information With Regular Expression
by sauoq (Abbot) on Jul 24, 2003 at 22:23 UTC | |
|
Re: Loop Through Scalar Obtain Information With Regular Expression
by Paladin (Vicar) on Jul 24, 2003 at 21:54 UTC | |
|
Re: Loop Through Scalar Obtain Information With Regular Expression
by Cody Pendant (Prior) on Jul 25, 2003 at 00:27 UTC |