Re: Optimize my script

2007-07-19 Thread JeeBee
Thanks very much. It runs a LOT faster now. Like 20 times or maybe even a bit more. I'm now trying to verify that the result is still the same, but I believe so. So, thanks very much :) JeeBee. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROT

Re: Optimize my script

2007-07-19 Thread JeeBee
7;t mean optional. (?: ... ) is to group an expression, just like ( ... ) does, but it also avoids creating a backpointer, which makes it faster. JeeBee. ps > thanks for the answers you've all been providing :) -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

Re: Optimize my script

2007-07-18 Thread JeeBee
Thanks Paul, I should profile of course, should have thought about that. I tried the below, but it's not quite clear what this means to me. When I run with "./analyze.pl foo bar" the execution time is fast, so the problem is not starting up/exiting of Perl, and I conclude it must be inside the s

Re: Optimize my script

2007-07-18 Thread JeeBee
ey (@stat_var_keys) { if($line =~ m/^\s*$stat_key$stat_pat/) { # $6 == "variance" $map{"var_$stat_key"} = $6; } } Can this regular expression be changed to do the same a be a lot faster? Thanks in advance, JeeBee. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

Optimize my script

2007-07-18 Thread JeeBee
d here's how I run it: $ time ./analyze.pl traplas-example output ... Directory /tmp: 1 good and 0 bad simulation runs. at ./analyze.pl line 546. real0m1.106s user0m1.012s sys 0m0.011s For such a small file (86 lines) over 1 second is a bit slow isn't it? Thanks again, JeeB

Re: Comparing two files of 8million lines/rows ...

2006-08-17 Thread JeeBee
Just an idea, don't know whether it's useful... If you can get both files sorted (either by adding order to your sql query that generates the file, or the commandline 'sort') the problem becomes much more easy. You'd just have to traverse each file, something like this: read word_1 from file_1 rea

Re: force requiring a file

2006-02-15 Thread JeeBee
Do I spot a space between ricerche/ and VALICO1497.pl? Is that space also in $nf? > Can't locate > /Library/WebServer/CGI-Executables/ e-allora/enter/ricerche/ VALICO1497.pl Try print "<$nf>"; -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTE

Re: Unicode character definition

2006-02-15 Thread JeeBee
> Please help me on the following code. The code is supposed to receive to > words "cool" and "cash" plus a number from 0 to 10, with optional spaces > between the words. Well, is the program argument quoted then? Like ./your_program "arg1 still arg1" Or is it actually that cash is in $ARGV[2] and

Re: help with adding strings that are floating point numbers

2006-02-14 Thread JeeBee
Just do $result = $var1 + $var2; int returns the integer part of a number, see: perldoc -f int JeeBee On Tue, 14 Feb 2006 07:04:18 -0800, Ravi Malghan wrote: > Hi: I think this is very trivial, but just can't seem to figure it out. I > have two strings $var1 = "0.12" and

Re: Equal length ID numbers

2005-12-15 Thread JeeBee
Yeps, use the printf function, something like this: $ perl -e 'printf("%04d\n", 1);' 0001 JeeBee. On Thu, 15 Dec 2005 14:42:46 +0100, Andrej Kastrin wrote: > Hi all, > > Suppose that we have numbers 1 to 1000 and we want all numbers be equal > l

Re: max value of an integer scalar

2005-11-03 Thread JeeBee
Thank you, John! I see the limit is 32 bits now. I just added 'use bigint', how easy! Further, I was wondering about why you said I wasn't just multiplying by 2 using $p<<=1. Isn't it exactly equal to $p*=2 ??? This has anything to do with overflow or the representation of a number? I though usi

max value of an integer scalar

2005-11-03 Thread JeeBee
Dear Perl experts, The following subroutine contains a while loop that continues to multiply $p by 2, until some condition is met. (It's for computing a Collatz tree) $p turns 0 in this loop, however, and it remains zero for ever, of course. My question is, what is exactly its maximum value? As I