CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
writing array element in a file

 

First page Previous page 1 2 Next page Last page  View All


francy87
Novice

Apr 29, 2013, 10:21 AM

Post #26 of 29 (538 views)
Re: [Laurent_R] writing array element in a file [In reply to] Can't Post

Hi FishMonger!
I'm sorry to bother you again, but I have another question. I'd like to add a progressive number beside S.thermophilus. That is, I have a file with:
0 Streptococcusthermophilus
10 Streptococcusthermophilus
100 Streptococcusthermophilus......
I want:
0 Streptococcusthermophilus_1
10 Streptococcusthermophilus_2
100 Streptococcusthermophilus_3
Do you know how can I do???
Thanks


Laurent_R
Veteran / Moderator

Apr 29, 2013, 12:10 PM

Post #27 of 29 (532 views)
Re: [francy87] writing array element in a file [In reply to] Can't Post

Yes, I know.

But since you did not ask me...

Unsure


francy87
Novice

Apr 29, 2013, 12:19 PM

Post #28 of 29 (531 views)
Re: [Laurent_R] writing array element in a file [In reply to] Can't Post

I'm sorry... I copied and pasted the name in the last post...Tongue


Laurent_R
Veteran / Moderator

Apr 29, 2013, 1:33 PM

Post #29 of 29 (527 views)
Re: [francy87] writing array element in a file [In reply to] Can't Post

Just make another couple of changes by adding a $count variable:


Code
my $count = 1; 
while (my $line = <$in>) {
chomp $line;
print $out "$1\tStreptococcusthermophilus_$count\n" if $line =~ /^> (\d+)/;
$count ++;
}


First page Previous page 1 2 Next page Last page  View All
 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives