Performance and precise

2005-08-23 Thread MNibble
Aloha I know this is not really the right News Groups but ... I'm ask to think of an solution for an Webapp that does some math on data in an database. The problem is, the DB has about 40.000.000 entries, the webapp needs to do mainly math on that data, the math should be "traceable", so no

regex remove of strings etc

2005-08-23 Thread Brent Clark
Hi all I need to remove the string "room" (notice the check for a space too) and also to check for spaces in the beginnig and then maybe at the end of the total string. $p110rm01 =~ s/(\sroom|^\s*|\s*$)//igo; Would someone be so kind as to check this for me. Kind Regards Brent Clark -- To u

Re: regex remove of strings etc

2005-08-23 Thread Muthukumar
> I need to remove the string "room" (notice the check for a space too) and > also to check for spaces in the beginnig and then maybe at the end > of the total string. > > $p110rm01 =~ s/(\sroom|^\s*|\s*$)//igo; > It is correct. You can try as, # echo " hi this is a room ok" | perl -ne 'if (

Re: regex remove of strings etc

2005-08-23 Thread Muthukumar
> It is correct. You can try as, > > # echo " hi this is a room ok" | perl -ne 'if ( /\s*.*\sroom.*\s*/ ) { > s/ room//;}print;' > # hi this is a ok oops. I hope pattern matching is not needed to your requirement. Your try is correct. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional c

Re: regex remove of strings etc

2005-08-23 Thread Muthukumar
Try with your input, # echo " hi this is a room ok " | perl -pe 's/(\sroom|^\s*|\s*$)//g' hi this is a ok# hth. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: regex remove of strings etc

2005-08-23 Thread Brent Clark
Muthukumar wrote: It is correct. You can try as, # echo " hi this is a room ok" | perl -ne 'if ( /\s*.*\sroom.*\s*/ ) { s/ room//;}print;' # hi this is a ok Hi you the man I cant believe I was sooo stupid in not thinking of your solution. thanks again Brent Clark -- To unsubscribe, e-mail:

Re: Performance and precise

2005-08-23 Thread Xavier Noria
On Aug 23, 2005, at 9:51, MNibble wrote: I'm ask to think of an solution for an Webapp that does some math on data in an database. The problem is, the DB has about 40.000.000 entries, the webapp needs to do mainly math on that data, the math should be "traceable", so no wild round offs.

open file for read and append

2005-08-23 Thread Dan Klose
Hello, I have a script where I need to open a file, read from it sequentially, and append items to the file as I go along, continuing to read these items as I go. But seems I can't open the file for read and append at the same time. Does anyone have any ideas? Many thanks. -- Daniel Klose PhD

Re: open file for read and append

2005-08-23 Thread Xavier Noria
On Aug 23, 2005, at 12:34, Dan Klose wrote: I have a script where I need to open a file, read from it sequentially, and append items to the file as I go along, continuing to read these items as I go. But seems I can't open the file for read and append at the same time. Does anyone have any ide

Re: open file for read and append

2005-08-23 Thread Muthukumar
> > I have a script where I need to open a file, read from it > > sequentially, > > and append items to the file as I go along, continuing to read these > > items as I go. But seems I can't open the file for read and append at > > the same time. Does anyone have any ideas? > Is it possible to ope

Re: regex remove of strings etc

2005-08-23 Thread John W. Krahn
Brent Clark wrote: > Hi all Hello, > I need to remove the string "room" (notice the check for a space too) > and also to check for spaces in the beginnig and then maybe at the end > of the total string. > > $p110rm01 =~ s/(\sroom|^\s*|\s*$)//igo; > > Would someone be so kind as to check this f

Last word

2005-08-23 Thread Todd Lewis
I'm trying to retrieve the last word from an HTML table cell stored in an array value. All of the words are space delimited. I've tried using split /\s/, $$row[1] but this doesn't always return the last word for me since there could be 2,3, or 4 words. Could someone point me in the right direc

Variables in replace regex

2005-08-23 Thread Jurgens du Toit
Hey all... I want to use groupings, (TEST), and replacement variables, $1, $2, etc, in a replacement regex, but the replacement is built into a variable. Like so: #!/usr/bin/perl my $replace = "urgent \$1"; my $string = "This is a TEST"; $string = s/(TEST)/$replace/gi; print $string; It outputs

Re: Last word

2005-08-23 Thread Peter Scott
On Tue, 23 Aug 2005 07:25:05 -0700, Todd Lewis wrote: > I'm trying to retrieve the last word from an HTML table cell stored in > an array value. > All of the words are space delimited. > I've tried using split /\s/, $$row[1] but this doesn't always return the > last > word for me since there cou

Problem with taint mode

2005-08-23 Thread Carol Overes
All, I'm using taint mode and I want to extract an archive on my filesystem. To untaint the content of the archive file, I'm matching the files in the archive against a regexp (this regexp is right now '.*' for testing purposes). This is the error that I get: Could not create directory '/tmp/unta

Re: Variables in replace regex

2005-08-23 Thread Peter Scott
On Tue, 23 Aug 2005 14:02:03 +0100, Jurgens du Toit wrote: > I want to use groupings, (TEST), and replacement > variables, $1, $2, etc, in a replacement regex, but > the replacement is built into a variable. Like so: > > #!/usr/bin/perl > > my $replace = "urgent \$1"; > my $string = "This is a TE

Re: Performance and precise

2005-08-23 Thread MNibble
Xavier Noria wrote: On Aug 23, 2005, at 9:51, MNibble wrote: I'm ask to think of an solution for an Webapp that does some math on data in an database. The problem is, the DB has about 40.000.000 entries, the webapp needs to do mainly math on that data, the math should be "traceable", so n

Re: Performance and precise

2005-08-23 Thread mgoland
- Original Message - From: MNibble <[EMAIL PROTECTED]> Date: Tuesday, August 23, 2005 7:57 am Subject: Re: Performance and precise > Xavier Noria wrote: > > On Aug 23, 2005, at 9:51, MNibble wrote: > > > >> I'm ask to think of an solution for an Webapp that does some > math on > >> d

Re: open file for read and append

2005-08-23 Thread Xavier Noria
On Aug 23, 2005, at 12:49, Muthukumar wrote: I have a script where I need to open a file, read from it sequentially, and append items to the file as I go along, continuing to read these items as I go. But seems I can't open the file for read and append at the same time. Does anyone have any i

IO::Socket squirreliness

2005-08-23 Thread Mason Loring Bliss
Hi, all! I'm learning about dealing with sockets in Perl, and I've got a question about some unexpected behaviour exhibited by the following test script. In the case where I open a connection and then close it before $socket->accept() is called, I'd except $socket->accept() to return undef, but it

Re: Variables in replace regex

2005-08-23 Thread Peter Scott
On Tue, 23 Aug 2005 06:30:07 -0700, I wrote: > > $string = s/(TEST)/qq("$replace")/giee; I mean =~ of course. Wups. -- Peter Scott http://www.perlmedic.com/ http://www.perldebugged.com/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Last word

2005-08-23 Thread Peter Scott
On Tue, 23 Aug 2005 06:17:11 -0700, I wrote: > $last_word = (split /\s/, $row->[1]//)[-1]; I seem beset by typos today. Don't know where that // came from. Should be: $last_word = (split /\s/, $row->[1])[-1]; -- Peter Scott http://www.perlmedic.com/ http://www.perldebugged.com/ -- To u

Re: Problem with taint mode

2005-08-23 Thread Peter Scott
On Tue, 23 Aug 2005 15:25:45 +0200, Carol Overes wrote: > I'm using taint mode and I want to extract an archive on my filesystem. > [snip] This is the error that I get: > > Could not create directory '/tmp/untar/test': Insecure dependency in > mkdir while running with -T switch at /usr/lib/perl5/5

mod_rewrite

2005-08-23 Thread Octavian Rasnita
Hi, I have read that Google doesn't like the links that have too many variables in them like ?id=...&id2=...&id3=... and so on. I would like to use mod_rewrite in order to be able to use nice looking links like http://www.site.com/val1/val2/val3/val4.html Is there a better way to get the variabl

Re: mod_rewrite

2005-08-23 Thread Joshua Colson
On Tue, 2005-08-23 at 20:40 +0300, Octavian Rasnita wrote: > Hi, > > I have read that Google doesn't like the links that have too many variables > in them like ?id=...&id2=...&id3=... and so on. > > I would like to use mod_rewrite in order to be able to use nice looking > links like http://www.si

Re: Variables in replace regex

2005-08-23 Thread Jay Savage
On 8/23/05, Jurgens du Toit <[EMAIL PROTECTED]> wrote: > Hey all... > > I want to use groupings, (TEST), and replacement > variables, $1, $2, etc, in a replacement regex, but > the replacement is built into a variable. Like so: > > #!/usr/bin/perl > > my $replace = "urgent \$1"; > my $string = "

regex stored in variables ?

2005-08-23 Thread Michael Gale
Hello, I have a script the loads regex into variables from a user config file, how ever I am unable to get perl to run the regex against the string. As I test have tried: my $exp_test="m/^\d+$/"; if ( (defined $string) && ($string =~ $exp_test ) ) { print $string, "\n"; } I have tried man

Re: regex stored in variables ?

2005-08-23 Thread Jeff 'japhy' Pinyan
On Aug 23, Michael Gale said: I have a script the loads regex into variables from a user config file, how ever I am unable to get perl to run the regex against the string. As I test have tried: my $exp_test="m/^\d+$/"; That's got a couple problems with it, but I'm not going to get into them

Re: regex stored in variables ?

2005-08-23 Thread Michael Gale
Ok, I have tried your suggestion and it is working perfectly, but I want to be able to load a variable from a file, so I am using the following method to do so: if ( -e "ConfigLoad.pm" ) { use ConfigLoad; $Config = new ConfigLoad(); } else { &contact_func("ERROR: Could not

[Fwd: Re: regex stored in variables ?]

2005-08-23 Thread Michael Gale
Hello, I resolved my issue, I forgot that in the file it may contain a CR, I used chomp to remove it. Michael Original Message Subject:Re: regex stored in variables ? Date: Tue, 23 Aug 2005 14:16:22 -0600 From: Michael Gale <[EMAIL PROTECTED]> To: beginner

Perl examples

2005-08-23 Thread anu p
Hi, I use perl once in a while for my office work, but I want to have more practice of it. It would be great if any one can suggest me some nice websites which have good practical perl examples. It would be nice if any one can help me with the scripts they have developed for their own use too.

Re: Perl examples

2005-08-23 Thread Walter Copenhaver
Hello, you can go to http://learn.perl.org/ click on the online library link at the top. They have very good stuff there. Walter. On 8/23/05, anu p <[EMAIL PROTECTED]> wrote: > Hi, > > I use perl once in a while for my office work, but I > want to have more practice of it. > > It would be gr

Shell output

2005-08-23 Thread Scott Taylor
Hello all, I have a CGI script that I need to display the output of a shell program, basically a simple C program that parses some text. The output is right to the browser, and I don't want it to be creating any new files or anything. I have a data field that has a blob and that blob needs to b

Re: Shell output

2005-08-23 Thread Wiggins d'Anconia
Scott Taylor wrote: > Hello all, > > I have a CGI script that I need to display the output of a shell program, > basically a simple C program that parses some text. > > The output is right to the browser, and I don't want it to be creating any > new files or anything. I have a data field that ha

Re: Shell output

2005-08-23 Thread Jay Savage
On 8/23/05, Scott Taylor <[EMAIL PROTECTED]> wrote: > > Hello all, > > I have a CGI script that I need to display the output of a shell program, > basically a simple C program that parses some text. > > The output is right to the browser, and I don't want it to be creating any > new files or any

Re: Shell output

2005-08-23 Thread Scott Taylor
Wiggins d'Anconia said: > Scott Taylor wrote: >> Hello all, >> >> I have a CGI script that I need to display the output of a shell >> program, >> basically a simple C program that parses some text. >> >> The output is right to the browser, and I don't want it to be creating >> any >> new files or

Re: Shell output

2005-08-23 Thread Scott Taylor
Jay Savage said: > On 8/23/05, Scott Taylor <[EMAIL PROTECTED]> wrote: >> >> Hello all, >> >> I have a CGI script that I need to display the output of a shell >> program, >> basically a simple C program that parses some text. >> >> The output is right to the browser, and I don't want it to be crea

Re: Last word

2005-08-23 Thread Todd Lewis
Thanks, for all the replys. Didn't know that you could simply reference the last element of an array by using [-1]. This seemed like it could be a one line task maybe two, just don't have command of the language. Peter Scott wrote: On Tue, 23 Aug 2005 06:17:11 -0700, I wrote: $last_wor