From 9aa75a97b9db70afaba2bc99bbb85ecb3d3c9ab2 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Sat, 20 Oct 2012 14:48:01 -0500 Subject: another solution --- REVP.pl | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 REVP.pl diff --git a/REVP.pl b/REVP.pl new file mode 100644 index 0000000..b6bce2b --- /dev/null +++ b/REVP.pl @@ -0,0 +1,16 @@ +#!/usr/bin/env perl +use strict; +use warnings; +use 5.016; + +chomp(my $input = <>); + +for my $start (1..length($input)) { + for my $length (4..8) { + next if $start + $length - 1 > length($input); + my $substr = substr($input, $start - 1, $length); + if ($substr eq (reverse $substr =~ tr/ACGT/TGCA/r)) { + say "$start $length"; + } + } +} -- cgit v1.2.3