As posted, the code is a cut-and-paste of a command line session. It is intended to show source code and invocation switches, pragmata, etc., command line input (to @ARGV), and command line output. The source code is everything between the pair of " (double-quotes). (Note that these are the only double-quotes in the posted code section.)
I don't know what you are doing to run the code, but try this:
-
Download the posted code section using the [download] link just after it.
-
Edit out the first " and everything before it, and also the last " and everything after it. What remains should be the entire source code.
-
Save the edited file.
-
Invoke the edited file with
the samealmost the same command line invocation used originally (Update: do not include the -e switch as I originally wrote below!) and with the sample input you want, e.g.:
perl -wMstrict -l your_file.pl GGGGaaaaaaCatttatatat atatataaatttttATtcccc
-
Examine output. Experiment with various different input data. Play with variations on the source code. Enjoy!
In fact, here's the edited section of code that should be all ready to go, just use the [download] link and save to a file of your choice:
die 'Please enter exactly two sequences' unless @ARGV == 2;
;;
my ($seq1, $seq2) = map uc, @ARGV;
die 'Please enter only ATCG sequences' if grep /[^ATCG]/, $seq1, $seq2
+;
;;
die 'Sequence lengths differ' if length $seq1 != length $seq2;
;;
(my $comp = $seq2) =~ tr/ATCG/TAGC/;
my $mask = $seq1 ^ reverse $comp;
;;
if ($mask !~ m{ [^\000] }xms) {
print 'The sequences are reverse-complementary';
exit;
}
;;
$mask =~ tr{\000-\377}{_^};
print 'Sequences are non-reverse-complementary at these locations:';
print qq{@ARGV};
print qq{$mask }, ''.reverse $mask;
Update: I just downloaded and saved the code block immediately above in this reply and went through the steps listed above (except it doesn't have to be edited), and it works. Be sure not to use the -e switch when invoking a file; it is used for command-line source code statements. HTH.