Hi, hopefully you are actually indenting your work and that it got unindented by not using code tags.
#! /usr/local/bin/perl -w use strict; open (INPUT, $ARGV[0]) or die "unable to open file";
This is precisely what the perl idiom while (<>){} is for
my $sequence; my $count =0; my $base = ("A"|"C"|"G"|"T");
This probably doesnt do what you want. $base ends up being the binary or of the string A C G and T. Which happens to be "W". :-)
my @array; my $ideal = 250; while (<INPUT>) {
As i said before the while loop can be rewritten much cleaner. Also you are reading in a line at a time because you havent messed with $/
$sequence = $_;
No need to save $_ unless intend to do something that will smash it. Which afact you arent.
@array = (); @array = split (/\n/, $sequence);
You read in a line, and then you split by \n. That wont help as there will only be 1 (or 0) but not more. So everything from there isnt going to go well. :-)

Maybe this does what you want, or least points you in the right direction?

while (<>) { chomp; # lose potential newlines at the end. (only needed for portab +ility) print $_,"\n" if length $_ > 250; # print out any sequence longer t +han 250chars }
One of the cool things about the while (<>) idiom is that it will allow you to do this:
# find every line over 250 chars from three different files, print the +m to STDOUT over_250 file.1 file.2 file.3 # find lines over 250 chars from STDIN over_250 <file.1

Yves / DeMerphq
Writing a good benchmark isnt as easy as it might look.

In reply to Re: simple but stuck by demerphq
in thread Base sequence length in fasta format file by lolly

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.