true false ? : expression thingy



I'm not sure what this method is called, which is perhaps why I've had no
luck when searching around the web for info on it, but when you want a
1-line alternative to an if...else.. construct, you can use the following
syntax:

$ctr > 3 ? $text = "yes" : $text = "no";

that works fine, however, when I try this:

my $incsubs;
$line =~ /\ts/i ? $incsubs = 0 : $incsubs = 1;

it doesn't work.. well, $incsubs equals 1 regardless whereas it works in the
standard if...else.. construct.

I guess this is because the regular expression doesn't return true/false, or
sth like that.. is there a "trick" you can use to make this type of method
work with regexps?

Bigus


.



Relevant Pages

  • GP/Bridi T-28 Kit for Auction
    ... Someone was searching for Great Planes T-28 info earlier,... ... Good Luck. ... Prev by Date: ...
    (rec.models.rc.air)
  • Re: Relay Source Question
    ... It's a "Double Pole Change Over" relay. ... Not having much luck ... searching for it. ... Prev by Date: ...
    (sci.electronics.components)
  • speaker impedance question
    ... ohm in it? ... i've been searching the web but not much luck. ... Prev by Date: ...
    (rec.music.makers.guitar.jazz)
  • RE: IE 6 wont open certain web pages
    ... I am having the same problem and have been searching ... I recently installed norton internet security ... > even unistalled norton but stil no luck! ... Prev by Date: ...
    (microsoft.public.windows.inetexplorer.ie6.browser)
  • Re: Fritz Lahmann Conduts Dvorak
    ... the record in both files, The Vegh Qrt Brahms 1st qrt. ... in any case archive.org has the files, but searching seems ... Good luck. ... Rolf, what's this McGreevy business? ...
    (rec.music.classical.recordings)