Tonight:
$times_at_the_plate = 43;
$walks = 8;
$sacs = 2;
$hit_by_pitch = 1;
$hits=11;
$official_at_bats = $times_at_the_plate - $walks - $sacs - $hit_by_pitch;
$average = $hits/$official_at_bats;
print "His average is: $average";
# =---------------------------------------------------=
$PLAYER{JETER} = .323;
$PLAYER{LEDEE} = .241;
$PLAYER{POSADA} = .245;
$PLAYER{KNOBLOCH} = .276;
foreach $name (keys %PLAYER) {
print "$name is batting $PLAYER{$name}\n";
}
# =---------------------------------------------------=
@PLAYERS = ("Hernandez", "Strawberry", "Knight", "Wilson", "Piazza", "Carter", "Santana");
foreach $name (@PLAYERS)
{
if ($name eq "Piazza")
{
print "Piazza didn't play for the '86 Mets.\n";
}
else
{
print "$name played for the '86 Mets.\n";
}
}