http://qs1969.pair.com?node_id=790438


in reply to Help understanding a single line of perl: my $count = $row[0] ? $row[0] : 0;

One question that might occur to someone who is new to this construct is "Why use it in this case?"

Because an undefined value is false, this little snippet of code will make sure that count is always defined to a specific value, even if $row[0] is not defined. So if your @row was the result of some operation that happened to return an empty list, $count would set to 0 rather than '';