#!/usr/bin/perl use strict; use warnings; my $infile = shift; open my $INPUT_FILE, "<", $infile" or die "can't open $infile: $!"; local $/; # the whole file will be slurped, even if it has several lines my $dna = <$INPUT_FILE>; if ( $dna =~ m/[^actg\s]/i ) { print "File contains something besides actg sequence.\n"; } else { print "good!\n"; } close $INPUT_FILE;