working with large integers

2011-12-29 Thread Jeswin
Hi, I'm doing one of the Project Euler exercises which asks the sum of 100 fifty-digit numbers[1]. My code is 2 parts: I open the text file containing the digits and put into an array: BEGIN_CODE= open (F, Fifty_hundred.txt) || die Could not open

Hello a question about .+?

2011-12-29 Thread Xi Chen
Hello everyone, I have a question about how to translate the meaning of .+?. Please see the examples below: SASI_Hs01_00205058 HUMAN NM_005762 857 MISSION® siRNA 2 140.00 I want to get number857, I found the command below works: perl -ne 'if

Re: File Size Script Help - Working Version

2011-12-29 Thread Jonathan Harris
On Thu, Dec 29, 2011 at 5:08 PM, Igor Dovgiy ivd.pri...@gmail.com wrote: Hi Jonathan, Let's review your script a bit, shall we? ) It's definitely good for a starter, but still has some rough places. #!/usr/bin/perl # md5-test.plx use warnings; use strict; use File::Find; use

Re: File Size Script Help - Working Version

2011-12-29 Thread Igor Dovgiy
Hi Jonathan, Let's review your script a bit, shall we? ) It's definitely good for a starter, but still has some rough places. #!/usr/bin/perl # md5-test.plx use warnings; use strict; use File::Find; use Digest::MD5; use File::Spec; So far, so good. ) my $dir = shift ||

Re: Hello a question about .+?

2011-12-29 Thread Chris Stinemetz
On Thu, Dec 29, 2011 at 1:17 PM, Xi Chen cxde...@gmail.com wrote: Hello everyone, I have a question about how to translate the meaning of .+?. Please see the examples below: SASI_Hs01_00205058      HUMAN   NM_005762       857     MISSION¬Æ siRNA 2                        140.00 I want to

re: File Size Script Help - Working Version

2011-12-29 Thread Jonathan Harris
Hi All Firstly, many thanks for your help previously (19/12/11) - it has led to making a useable script I don't think it's brilliantly written, it seems a little bodged together to me... but works fine - not a bad result for a first script If you are new to this problem and are interested in

Re: working with large integers

2011-12-29 Thread Shlomi Fish
Hi Jeswin, On Thu, 29 Dec 2011 11:40:09 -0500 Jeswin phillyj...@gmail.com wrote: Hi, I'm doing one of the Project Euler exercises which asks the sum of 100 fifty-digit numbers[1]. My code is 2 parts: I open the text file containing the digits and put into an array:

Re: File Size Script Help - Working Version

2011-12-29 Thread John W. Krahn
Jonathan Harris wrote: Hi Igor Many thanks for your response I have started reviewing the things you said There are some silly mistakes in there - eg not using closedir It's a good lesson in script vigilance I found the part about opening the file handle particularly interesting I had no

Re: Hello a question about .+?

2011-12-29 Thread Shawn H Corey
On 11-12-29 02:45 PM, Chris Stinemetz wrote: On Thu, Dec 29, 2011 at 1:17 PM, Xi Chencxde...@gmail.com wrote: Hello everyone, I have a question about how to translate the meaning of .+?. Please see the examples below: SASI_Hs01_00205058 HUMAN NM_005762 857 MISSION® siRNA 2

Re: Hello a question about .+?

2011-12-29 Thread Xi Chen
Thank you so much! This answer is very clear!! On Thu, Dec 29, 2011 at 2:03 PM, Kronheim, David (Contr) david.kronh...@ftr.com wrote: Actually, the ending ? makes the match non-greedy, in detail: Given: SASI_Hs01_00205058      HUMAN   NM_005762       857     MISSION¬Æ siRNA 2                

RE: Hello a question about .+?

2011-12-29 Thread Kronheim, David (Contr)
Actually, the ending ? makes the match non-greedy, in detail: Given: SASI_Hs01_00205058 HUMAN NM_005762 857 MISSION® siRNA 2 140.00 if (/(SASI\w+)(.+?)\s(\d+)\s/) { print $3\n; } Match starts looking for the literal SASI followed by one or more \w's, which

Re: File Size Script Help - Working Version

2011-12-29 Thread Jonathan Harris
On Thu, Dec 29, 2011 at 6:39 PM, John W. Krahn jwkr...@shaw.ca wrote: Jonathan Harris wrote: Hi Igor Many thanks for your response I have started reviewing the things you said There are some silly mistakes in there - eg not using closedir It's a good lesson in script vigilance I found

Re: File Size Script Help - Working Version

2011-12-29 Thread Jonathan Harris
On Fri, Dec 30, 2011 at 12:33 AM, Jonathan Harris jtnhar...@googlemail.comwrote: On Thu, Dec 29, 2011 at 6:39 PM, John W. Krahn jwkr...@shaw.ca wrote: Jonathan Harris wrote: Hi Igor Many thanks for your response I have started reviewing the things you said There are some silly

Re: File Size Script Help - Working Version

2011-12-29 Thread John W. Krahn
Jonathan Harris wrote: On Thu, Dec 29, 2011 at 6:39 PM, John W. Krahnjwkr...@shaw.ca wrote: Igor made a lot of good points. Here are my two cents worth. You are using the File::Find module to traverse the file system and add new files along the way. This _may_ cause problems on some file

Re: File Size Script Help - Working Version

2011-12-29 Thread John W. Krahn
Jonathan Harris wrote: FInally, I was advised by a C programmer to declare all variables at the start of a program to avoid memory issues Is this not necessary in Perl? It is not really necessary in C either. John -- Any intelligent fool can make things bigger and more complex... It takes

What does = means?

2011-12-29 Thread Xi Chen
Hello everyone, I saw a code below to get two same letters p in @a. @a = qw (D D p O H p A O); foreach $b (@a){ $n =~ /$b/i; if($n = 2){ $m = $b; } } But I don't know what does = mean. Thank you! Xi -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands,

Re: What does = means?

2011-12-29 Thread Chris Stinemetz
On Thu, Dec 29, 2011 at 9:26 PM, Xi Chen cxde...@gmail.com wrote: Hello everyone, I saw a code below to get two same letters p in @a. @a = qw (D D p O H p A O); foreach $b (@a){ $n =~ /$b/i; if($n = 2){     $m = $b;    } } But I don't know what does = mean. Thank you! It is just

Re: What does = means?

2011-12-29 Thread John W. Krahn
Xi Chen wrote: Hello everyone, I saw a code below to get two same letters p in @a. @a = qw (D D p O H p A O); foreach $b (@a){ $n =~ /$b/i; if($n= 2){ $m = $b; } } But I don't know what does = mean. Thank you! It means greater than or equal to. The expression $n = 2 is true if