So, the bioinformatics class uses Perl. I looked into Perl a long time ago and it never really appealed to me but it seems like computer science classes love it and Java. I have been wanting to try some of the problems over at Project Euler out for a while and thought this would be an ideal time. I wish I had the time to try more but I probably won’t — desides, there are more interesting problems that have my interest right now. Here is Perl script to find solution 1.
#!/usr/bin/perl
# problem number 1 from project euler
use strict;
use warnings;
my $sum = 0;
my $i = 0;
for ($i = 1; $i < 1000; $i++) {
if ($i % 3 == 0 || $i % 5 == 0) {
$sum = $sum + $i;
}
}
# print the answer
print “The sum of all of the multiples of 3 and 5 below 1000 is $sum\n\n”;