CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
Decode this for me?

 



akula
New User

Jul 28, 2009, 12:18 PM

Post #1 of 3 (420 views)
Decode this for me? Can't Post

if ($txt =~ s|^===.*$|$code ? "</code>" : "<br /><code>"|e) { $code = ~$code }

I cannot find out the function and purpose of "e"?


KevinR
Veteran


Jul 28, 2009, 1:01 PM

Post #2 of 3 (417 views)
Re: [akula] Decode this for me? [In reply to] Can't Post

from prelrequick:

The evaluation modifier s///e wraps an eval{...} around the replacement string and the evaluated result is substituted for the matched substring.

http://perldoc.perl.org/perlrequick.html

It enables you to insert code into the replacement side of a substitution regexp and have the code executed. Which is what that regexp is doing with the ternary operator in the replacement side of the regexp. It checks if $code equals </code> and if it does replaces it with <br /><code>.
-------------------------------------------------


akula
New User

Jul 28, 2009, 1:09 PM

Post #3 of 3 (415 views)
Re: [akula] Decode this for me? [In reply to] Can't Post

Got it now. thank you very much.

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives