in reply to Syntax for 1 line "either this or this"

Hi theAcolyte.

The ternary operator '?:' was inherited from 'C' I believe. It works like this:

#!/usr/bin/perl -w use strict; my $myvar; my $val1; $myvar = defined $val1 ? $val1 : "Blah"; print $myvar;

If the value stored in the variable $val1 is defined, assign the value stored at its address to $myvar. Otherwise, assign the string "Blah" to it. The logic could be expressed as:

If $var1 is defined, perform the assignment on the immediate right of the '?'. Else, perform the assignment on the right of the ':'.

Hope this helps,
-Katie.