in reply to How to cater a self defined escape char in regex ?

Are you sure that your question is not an XY Problem?

Why do you construct your string in the first place while you can avoid parsing it back using regexes if you make a simple check, like this?

my $greet = $name ? $obj->{getName}->($name) : "<what you wanted to do + in case of (unknown)>";
(read Conditional Operator if you don't know what <condition> ? <value> : <value> means)

Replies are listed 'Best First'.
Re^2: How to cater a self defined escape char in regex ?
by exilepanda (Friar) on Apr 08, 2013 at 17:36 UTC
    Thanks aitap. Honestly, I can't self determine am I asking XY question. If I am asking Y for X, at lease at the the moment I was posting, I believed that I was asking X. Moreover, what is X and which is Y is quite depends on how the reader understand the question. Thaz what I am still learning to understand.

    However, I've so realized that I am putting this question badly. I've tried to rephrase it in this reply. I hope, if you don't mind, please teach me if I am asking the right question this time. Thanks again! =)