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

j.goor has asked for the wisdom of the Perl Monks concerning the following question:

Fellow Monks,
Consider my next question a very basic question, purely for my own fun:
What is better or more preferred in the next example (and why?):
A)
my $T; if ($hour > 12) { $hour -= 12; $T = 'PM'; } else { $T = 'AM'; }
Or:
B)
my $T = 'AM'; if ($hour > 12) { $hour -= 12; $T = 'PM'; }
See the detail?
I was wandering what 'solution' would be better, since I run into these kind of thing regularly and it made me curious if there would be a 'common' way to handle this.
Rgds,
John