Hi,
I created the following Perl subroutine to print string MALE or FEMALE. When subroutine is invoked, the print command suffixes a "1" at the end of the string. See the sample code and output below:
sub gender {
if ( (int rand(100)) >50) {
print "MALE ";
}
else {
print "FEMALE";
}
}
foreach (1..5) {
print &gender, "\n";
} OUTPUT:
FEMALE1 FEMALE1 MALE 1 MALE 1 FEMALE1 MALE 1
Why does this happen?
1 year 26 weeks ago
Use
and not