I'll just answer the 'other stuff'.

> ##this does not work....
> 
> print ($sort_order) ? 'Newest First' : 'Oldest First';

Perl sees this as a function() call followed by the rest.

Instead, do:

> print $sort_order ? 'Newest First' : 'Oldest First';

In general, Perl works to minimize the number of
brackets you need.

> $sort_type = ($sort_order) ? 'Newest First' : 'Oldest First';
> # are the () optional?

Yes.

The issue is 'precedence'.

When in doubt, I usually switch to a command prompt
and enter a few perl one liners, eg I just tried

    perl -e 'print $foo ? 1 : 2'

to confirm that I was right about one of the above points.

Reply via email to