Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: reg reggular expressions

by kielstirling (Scribe)
on Feb 09, 2012 at 06:41 UTC ( #952664=note: print w/replies, xml ) Need Help??


in reply to reg reggular expressions

Hi,

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

Replies are listed 'Best First'.
Re^2: reg reggular expressions
by Anonymous Monk on Feb 09, 2012 at 06:52 UTC

    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;

        ya this seems to be a better option. however i cant give each pattern individually in quotes so i ll make it read from a file. thank you.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://952664]
help
Chatterbox?
[ambrus]: MLX: if it's a work email, then it's probably not Uncle Sam that matters, but what the account managing server at work thinks your name is. Those can differ. For example, we've had two co-workers with identical real name at one point,
[ambrus]: so one got a stupid suffix in the email account (people have email address based on their real name here usually).

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (14)
As of 2017-01-19 14:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you watch meteor showers?




    Results (170 votes). Check out past polls.