in reply to RE: Timezones in Perl
in thread Timezones in Perl
There are a couple of stylistic points that I'd like to make about your code - one more serious than the other.
The more serious one is that you're using array slices where you want scalars. That is where you're using @local_tm[2] you should be using $local_tm[2].
The less serious issue is that you don't need to split up the parameters to print. You can do something like this:
print "$local_tm[2]:$local_tm[1]:$local_tm[0] $tz\n";
or (to get the formatting a little nicer) you can use printf:
printf '%02d:%02d:%02d %d', $local_tm[2], $local_tm[1], $local_tm[0], $tz;
or (to really show people how well you know Perl) use printf and an array slice:
printf '%02d:%02d:%02d %d', @local_tm[2, 1, 0], $tz;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
RE: RE: RE: Timezones in Perl
by ArthurDent (Acolyte) on Jun 26, 2000 at 18:13 UTC |