#!usr/bin/perl

# Introduce loops and functions. Concept focus: Iteration, modularization. More string manipulation: parsing, identifying, counting sequence snippets.

# this is a function. you can call it many times
sub lookup($) {
    my $motif = $ARGV[0];
    print "Is $motif found in $_[0]? ";
    if ($_[0] =~ /$motif/) {
        print "Found it!\n";
        print "How many times?";
        # the hard way (a loop)
        # the easy way (regular expression pattern-matching and countings)
    }
    else {
        print "Nope...\n";
    }
}
# end of function


# main body of code
my $seq = "ACGTGGCGCCGGCGCCATATATTTA";

print "My sequence: " . $seq . "\n";

lookup($seq);
