Michael Fowler wrote:
> On Tue, Jun 05, 2001 at 08:05:24AM -0400, Herb Hall wrote:
> > $min = "0" . $min if $min < 10;
> >
> > will pad your minutes with a 0. I have used both methods for various
> > reasons. You probably only need to use one or the other. I would use the
> > printf unless you hav
On Tue, Jun 05, 2001 at 08:05:24AM -0400, Herb Hall wrote:
> $min = "0" . $min if $min < 10;
>
> will pad your minutes with a 0. I have used both methods for various
> reasons. You probably only need to use one or the other. I would use the
> printf unless you have some need to have the variables
> ### 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/$y
David Gilden wrote:: ##this does not work
:
: print ($sort_order) ? 'Newest First' : 'Oldest First';
Perl thinks you're doing this:
print($sort_order) ? 'Newest First' : 'Oldest First';
that is, it's taking $sort_order as an argument to print().
Either remove the parens:
print $sort_ord
David Gilden wrote:
> Is there a way to combine the last two statements?
[...]
> $sort_type = ($sort_order) ? 'Newest First' : 'Oldest First';
> # are the () optional?
>
> print $sort_type;
print $sort_order ? 'Newest First' : 'Oldest First';
or
print( $sort_order ? 'Newest Fi
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 numbe
On Jun 1, David Gilden said:
>$sort_order =0;
>
>$sort_type = ($sort_order) ? 'Newest First' : 'Oldest First';
># are the () optional?
In this case, yes, you don't need those parens.
>print ($sort_order) ? 'Newest First' : 'Oldest First';
Remove the parens, or add them around the entire argume
On Fri, Jun 01, 2001 at 03:05:59PM -0400, David Gilden wrote:
[snip -- was there a question about '?:' ?]
> 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 fr
Remove the ()'s and it works.
For the 0's:
printf "On %02d/%02d/%04d At %02d:%02d you wrote:\n\n", $month, $mday,
$year, $hour, $min;
see perldoc -f printf for more info.
- Original Message -
From: "David Gilden" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, June 01, 2001 1:05