![]() |
|
go ahead... be a heretic | |
PerlMonks |
Re: switching parts of a textby hgolden (Pilgrim) |
on Sep 14, 2006 at 20:58 UTC ( [id://573007]=note: print w/replies, xml ) | Need Help?? |
Hey, When you match the move strings, you can capture the information you need with a regular expression. If the string will always be like what you show, then this could be: and then the line you want will be print WHATEVER "$2 := $1", since the first thing in paratheses goes into $1 and the second thing into $2. With some tuning up, that should cover your first two concerns. For the last one, if there won't be any other single-quotes, you could just perform a substitution. If you're expecting them in the strings, then you can do a substitution which includes the end of string character: $. That way, you'll only match the final single-quote. I hope this helps. Hays
In Section
Seekers of Perl Wisdom
|
|