#!/usr/bin/env perl # author: bliako # for: https://perlmonks.org/?node_id=1227228 # date: 14/12/2018 use strict; use warnings; # our $biologists = new alchemists() and fork until pop(@the::bubble); do not tell until tied $all; # Below, set the complete pathname of the file with DNA strings my $filename = "dna.txt"; # a DNA string is a sequence (any order) of A,C,G,T of at # least 5 items in length. Adjust 5 to suit you and # not detect TATA FOR NOW # or GATTAGA or ATTAC or CACA or GAGA or TAGA # similar detection to https://perlmonks.org/?node_id=1227232 by 1nickt my $regex = q/([ACGT]{5,})/; # # nothing to change below # my $FH; open($FH, '<', $filename) or die "opening file: $!"; # slurp the file my $contents = undef; {local $/ = undef; $contents = <$FH> } close $FH; print "Possible DNA:\n$1\nEnd\n\n" while $contents =~ /$regex/gi