Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Count Occurrences of a string

by Zaxo (Archbishop)
on Sep 10, 2003 at 00:27 UTC ( [id://290248]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    #!/usr/bin/perl -w
    use strict;
    
    die 'Usage: ctpA [DIR]' if @ARGV > 1;
    my $dir = shift || '.';
    
  2. or download this
    use File::Basename;
    open local(*OUT), "> $dir/pA.cat" or die $!;
    
  3. or download this
    for (glob "${dir}/*.seq" ) {
  4. or download this
        local $/;
        open local(*IN), "< $_" or die $!;
        my $seq = <IN>;
        close IN or die $!;
    
  5. or download this
        $seq =~ s/\s//g;
  6. or download this
        $seq =~ /([AN]*)$/;
        printf OUT "%d %s.seq\n", length $1, basename $_;
    }
    
  7. or download this
    close OUT or die $!;

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://290248]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (4)
As of 2024-04-20 10:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found