Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

reg reggular expressions

by Anonymous Monk
on Feb 09, 2012 at 06:30 UTC ( [id://952663]=perlquestion: print w/replies, xml ) Need Help??

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi all,
I have a file with multipe patterns which are repeated. i want to find the occurance of each pattern (the name) and the no of times it is occured, using regular expressions. can any one help me out thank u

Replies are listed 'Best First'.
Re: reg reggular expressions
by kielstirling (Scribe) on Feb 09, 2012 at 06:41 UTC
    Hi,

    This is a very vague question. Supply more details and some example code and I'll try to help you.

      if the file is like this..
      mmu-miR-16-1-3p 8
      mmu-miR-1-1-3p 8
      mmu-miR-500
      mmu-miR-16-1-3p 8
      i need to identify how many individal patterns are available; how many repeats are there for each individual. thank you

        Hi,

        I would use a hash..

        #!/usr/bin/perl -w use strict; my @files = ( "mmu-miR-16-1-3p 8", "mmu-miR-1-1-3p 8", "mmu-miR-500", "mmu-miR-16-1-3p 8" ); my %pattern_count; map $pattern_count{$_}++, @files; print "filename $_ patten count $pattern_count{$_}\n" for keys %pattern_count;

Log In?
Username:
Password:

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

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

    No recent polls found