in reply to Maximum string length
See if that produces the same result as your friend's C++ code.use warnings; use strict; system 'clear'; print "Palindrome - gamma version\n"; print "--------------------------\n\n"; print 'Please enter DNA filename: '; chomp( my $filename = <STDIN> ); open DNASEQ, $filename or die "Cannot open $filename: $!"; ( my $dna = do { local $/; <DNASEQ> } ) =~ tr/atcgATCG//cd; my $count_of_2 = () = $dna =~ /a(?=t)|t(?=a)|c(?=g)|g(?=c)/ig; print "Number of 2bp palindromes: ", $count_of_2, "\n"; __END__
|
|---|