Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery

Re^3: Ternary inside a regex

by izut (Chaplain)
on Sep 23, 2005 at 12:46 UTC ( #494505=note: print w/replies, xml ) Need Help??

in reply to Re^2: Ternary inside a regex
in thread Ternary inside a regex

I think this way is easier to read:
message =~ s~\[size=(.+?)\](.+?)\[/size\]~"<font size=\"".(($1 > 5) ? +5 : $1)."\>$2</font>"~eisg;

Igor S. Lopes - izut
surrender to perl. your code, your rules.

Replies are listed 'Best First'.
Re^4: Ternary inside a regex
by kiat (Vicar) on Sep 23, 2005 at 13:12 UTC
    Nice! I wanted to do that but didn't manage to - I didn't have the parentheses.

    Thanks :)

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://494505]
[prospect]: Learning Perl There where 17 videos.
[prospect]: And it was great because I'm using the book as well, to get some more examples or extra information
[ambrus]: Ask merlyn directly. Maybe he has copies.
[ambrus]: write him an email or something
[prospect]: ok I will

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (6)
As of 2017-09-25 10:30 GMT
Find Nodes?
    Voting Booth?
    During the recent solar eclipse, I:

    Results (279 votes). Check out past polls.