Here is my code:
for($i=1;$i<=100;$i++){
if($i%15==0) print "Divisible by 15";
else if($i%5==0) print "Divisible by 5";
else print ($i%3==0)? "Divisible by 3":$i;
print "
";
}
Its a really simple code. I got it working in Java, though it gives an error in Perl. The error is :
syntax error at line 2, near ") print"
Execution aborted due to compilation errors.
I'm new to Perl. How can I get it working?
See Question&Answers more detail:os