Re: 1-line text file with numbers, need to add to them

2010-02-06 Thread 7
On 2/4/10, Chris wrote: > On Feb 4, 10:59 am, shlo...@iglu.org.il (Shlomi Fish) wrote: >> Hi Chris! >> >> Have you visitedhttp://perl-begin.org/yet and read a good introductory >> book >> or tutorial? >> >> On Thursday 04 Feb 2010 09:27:32 Chris wrote: >> >> > I need some help with this problem. >

Re: 1-line text file with numbers, need to add to them

2010-02-05 Thread Uri Guttman
> "cc" == chaccou...@camcontacts com writes: cc> Please unsubscribe from chaccou...@camcontacts.com and h...@camcontacts.com i don't manage this list. you can follow the directions for subscribing which are in the headers of each email on the list. uri -- Uri Guttman -- u...@stem

Re: 1-line text file with numbers, need to add to them

2010-02-05 Thread Uri Guttman
> "F" == Frank writes: F> #!/usr/bin/perl F> open(DATA,"data.txt"); F> while() { F> $number=$_; F> # print $number; F> while ($number =~ /([0-9]+)~s/g){ F> printf ("%d\n","$1"); F> } F> } F> close(DATA); regardless of the poor code there and others have commen

Re: 1-line text file with numbers, need to add to them

2010-02-05 Thread John W. Krahn
Frank wrote: On Feb 4, 4:35 pm, jwkr...@shaw.ca ("John W. Krahn") wrote: Chris wrote: I need some help with this problem. I've got a text file datafile with 1 line of data comprised of 30 different numbers delimited with ~s. I need to open this file, grab this line of data, split it into indivi

Re: 1-line text file with numbers, need to add to them

2010-02-05 Thread Frank
On Feb 4, 4:35 pm, jwkr...@shaw.ca ("John W. Krahn") wrote: > Chris wrote: > > I need some help with this problem. > > I've got a text file datafile with 1 line of data comprised of 30 > > different numbers delimited with ~s. > > > I need to open this file, grab this line of data, split it into > >

Re: 1-line text file with numbers, need to add to them

2010-02-05 Thread Chris
On Feb 4, 2:27 am, cacogg...@gmail.com (Chris) wrote: > I need some help with this problem. > I've got a text file datafile with 1 line of data comprised of 30 > different numbers delimited with ~s. > > I need to open this file, grab this line of data, split it into > individual numbers, perform so

Re: 1-line text file with numbers, need to add to them

2010-02-05 Thread FrankCai
For instance, here is your data file. data.txt 12~s1~s314~s5677~s899~s0~s Then, here is the code. #!/usr/bin/perl open(DATA,"data.txt"); while() { $number=$_; # print $number; while ($number =~ /([0-9]+)~s/g){ printf ("%d\n","$1"); } } close(DATA); On Feb 4, 7:27 am, cacogg...@gmai

Re: 1-line text file with numbers, need to add to them

2010-02-05 Thread Shlomi Fish
Hi Frank! On Thursday 04 Feb 2010 19:24:41 Frank wrote: > For instance, the below is your data file --data.txt > 12~s1~s314~s5677~s899~s0~s > Here are the codes: > > #!/usr/bin/perl > open(DATA,"data.txt"); > while() { > $number=$_; > # print $number; > while ($number =~ /([0-9]+)~s/g){ >

Re: 1-line text file with numbers, need to add to them

2010-02-05 Thread Frank
For instance, the below is your data file --data.txt 12~s1~s314~s5677~s899~s0~s Here are the codes: #!/usr/bin/perl open(DATA,"data.txt"); while() { $number=$_; # print $number; while ($number =~ /([0-9]+)~s/g){ printf ("%d\n","$1"); } } close(DATA); On Feb 4, 7:27 am, cacogg...@gmail

Re: 1-line text file with numbers, need to add to them

2010-02-05 Thread Chris
On Feb 4, 10:59 am, shlo...@iglu.org.il (Shlomi Fish) wrote: > Hi Chris! > > Have you visitedhttp://perl-begin.org/yet and read a good introductory book > or tutorial? > > On Thursday 04 Feb 2010 09:27:32 Chris wrote: > > > I need some help with this problem. > > I've got a text file datafile with

Re: 1-line text file with numbers, need to add to them

2010-02-04 Thread John W. Krahn
Chris wrote: I need some help with this problem. I've got a text file datafile with 1 line of data comprised of 30 different numbers delimited with ~s. I need to open this file, grab this line of data, split it into individual numbers, perform some simple math (addition) on each number, and then

Re: 1-line text file with numbers, need to add to them

2010-02-04 Thread Shlomi Fish
Hi Chris! Have you visited http://perl-begin.org/ yet and read a good introductory book or tutorial? On Thursday 04 Feb 2010 09:27:32 Chris wrote: > I need some help with this problem. > I've got a text file datafile with 1 line of data comprised of 30 > different numbers delimited with ~s. > >

1-line text file with numbers, need to add to them

2010-02-04 Thread Chris
I need some help with this problem. I've got a text file datafile with 1 line of data comprised of 30 different numbers delimited with ~s. I need to open this file, grab this line of data, split it into individual numbers, perform some simple math (addition) on each number, and then put the new va