Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: chopping new line while counting length

by andye (Curate)
on Jan 15, 2009 at 11:51 UTC ( #736519=note: print w/ replies, xml ) Need Help??


in reply to chopping new line while counting length

An alternative way to do it:

#!/usr/bin/perl -w undef $/; use strict; $_ = <DATA>; while (m/\G(>IDnumber\d+ length=)350\n([^\n]+)\n([^\n]+)\n/g) { print $1.length($2.$3)."\n$2$3\n"; } __DATA__ >IDnumber1 length=350 AGCTG AAGTCGCT >IDnumber2 length=350 AGAACGT ACC >IDnumber3 length=350 AGC ACTTCGCTAACT

Hope that's helpful to you.

Best wishes, andye


Comment on Re: chopping new line while counting length
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (4)
As of 2014-07-14 05:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (255 votes), past polls