Good afternoon,

Is there a way to combine the last two statements?

#!/usr/bin/perl -w

$sort_order =0;

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

print $sort_type;


##this does not work....

print ($sort_order) ? 'Newest First' : 'Oldest First';

----printf question--

### get time
my($sec, $min, $hour, $mday, $month, $year) = (localtime)[0..5];
$year += 1900;
$mday = "0" . $mday if $mday < 10;
$month++; # perl counts from -1 on occasion
$month = "0" . $month if $month < 10;
####

-- later in the same file --

print TOFILE "On $month/$mday/$year At $hour:$min you wrote:<br>\n\n";

how do I use print to provide a leading '0' to $min, such that
I get 5:01 and not 5:1


Thanks!

Dave G.

Reply via email to