what's a database handler

2009-12-20 Thread 小兰
Hi, When I get a database handler with DBI, my $dbh = DBI->connect(...); Then I fork in the script: my $pid = fork; if ($pid ) { # parent do something; } else { # child do something another; $dbh->disconnect; } What I want to know is, when $dbh get disconnected in child, will it in

Re: cgi and absolute filenames

2009-12-20 Thread Randal L. Schwartz
> "reader" == reader writes: reader> When using cgi to run scripts over html, what is the right addressing reader> scheme when the script needs to open or alter files on the server. *Most* CGI execution engines "cd" to the path of the script when executing that script. Hence opening ">foo"

Re: Git Talk by Randal

2009-12-20 Thread Randal L. Schwartz
> "Erez" == Erez Schatz writes: Erez> One problem I have with Merlyn, is when he starts talking about Erez> something, you're willing to throw everything away and go where he Erez> points. He's such a passionate, compelling speaker. Erez> My other problem is that he's mostly right. [blush]

Re: Simple OOPs related query.

2009-12-20 Thread Shlomi Fish
On Sunday 20 Dec 2009 21:15:53 Parag Kalra wrote: > Hello All, > > Just started learning OOPs in Perl from the book 'Intermediate Perl' > written by Randal. As well as brian d foy and Tom Phoenix I may add. > > I have written a small program given below. Its working at most places > except whi

Re: new member

2009-12-20 Thread Shlomi Fish
Hi Sajad! On Sunday 20 Dec 2009 20:02:53 sajad sadeghi wrote: > hello > i am new member ,i want to know can i post my question to this or i must > post it another where? All Perl-related questions are acceptable here. With some more advanced and specialised questions, you may have better luck w

cgi and absolute filenames

2009-12-20 Thread reader
This may belong somewhere else... but I'm pretty sure someone here can tell me about this. When using cgi to run scripts over html, what is the right addressing scheme when the script needs to open or alter files on the server. For example... a cgi writes a page for viewing. the cgi needs to ope

Simple OOPs related query.

2009-12-20 Thread Parag Kalra
Hello All, Just started learning OOPs in Perl from the book 'Intermediate Perl' written by Randal. I have written a small program given below. Its working at most places except while printing color of unnamed creatures. Just execute the script and you will figure out the bug. Could someone explai

Re: Regexp to remove spaces

2009-12-20 Thread Robert Wohlfarth
On Sat, Dec 19, 2009 at 9:13 PM, sftriman wrote: > I use this series of regexp all over the place to clean up lines of > text: > > $x=~s/^\s+//g; > $x=~s/\s+$//g; > $x=~s/\s+/ /g; > > in that order, and note the final one replace \s+ with a single space. > > Basically, it's (1) remove all leading

Re: new member

2009-12-20 Thread Parag Kalra
As long as your query is related to Perl, you are free to shoot the question here. Cheers, Parag On Sun, Dec 20, 2009 at 11:32 PM, sajad sadeghi wrote: > hello > i am new member ,i want to know can i post my question to this or i must > post it another where? ,my questions is about some progr

new member

2009-12-20 Thread sajad sadeghi
hello i am new member ,i want to know can i post my question to this or i must post it another where? ,my questions is about some program of perl and how to program... -- والحمدلله

Re: Regexp to remove spaces

2009-12-20 Thread Shawn H Corey
John W. Krahn wrote: > That can be reduced to: > > $text =~ tr/ \t\n\r\f/ /s; > > But that still doesn't remove leading and trailing whitespace so add two > more lines: > > $text =~ tr/ \t\n\r\f/ /s; > $text =~ s/\A //; > $text =~ s/ \z//; That was left as an exercise to the reader. Come now,

Re: Faster way to do a regexp using a hash

2009-12-20 Thread John W. Krahn
sftriman wrote: I've been wondering for a long time... is there a slick (and hopefully fast!) way to do this? foreach (keys %fixhash) { $x=~s/\b$_\b/$fixhash{$_}/gi; } So if $x="this could be so cool" and $fixhash{"could"}="would"; $fixhash{"COOL"}="awesome"; $fixhash{"beso"}="nope"; $fi

Re: Regexp to remove spaces

2009-12-20 Thread John W. Krahn
Shawn H Corey wrote: sftriman wrote: I use this series of regexp all over the place to clean up lines of text: $x=~s/^\s+//g; $x=~s/\s+$//g; $x=~s/\s+/ /g; in that order, and note the final one replace \s+ with a single space. Basically, it's (1) remove all leading space, (2) remove all trail

Re: Faster way to do a regexp using a hash

2009-12-20 Thread Erez Schatz
2009/12/20 sftriman : > I've been wondering for a long time... is there a slick (and hopefully > fast!) way > to do this? > > foreach (keys %fixhash) { >    $x=~s/\b$_\b/$fixhash{$_}/gi; > } You can do a global substitute of the sentence and see if they match any key in the hash. i.e.: $x =~ s/\b

Re: Regexp to remove spaces

2009-12-20 Thread Shawn H Corey
sftriman wrote: > I use this series of regexp all over the place to clean up lines of > text: > > $x=~s/^\s+//g; > $x=~s/\s+$//g; > $x=~s/\s+/ /g; > > in that order, and note the final one replace \s+ with a single space. > > Basically, it's (1) remove all leading space, (2) remove all trailing

Re: Faster way to do a regexp using a hash

2009-12-20 Thread Shawn H Corey
sftriman wrote: > I've been wondering for a long time... is there a slick (and hopefully > fast!) way > to do this? > > foreach (keys %fixhash) { > $x=~s/\b$_\b/$fixhash{$_}/gi; > } > > So if > > $x="this could be so cool" > > and > > $fixhash{"could"}="would"; > $fixhash{"COOL"}="awesome"

Re: Regexp to remove spaces

2009-12-20 Thread Erez Schatz
2009/12/20 sftriman : > I use this series of regexp all over the place to clean up lines of > text: > > $x=~s/^\s+//g; > $x=~s/\s+$//g; > $x=~s/\s+/ /g; > You can probably use $x=~s/^(\s+)|(\s+)$//g; But I don't think it will use any less CPU than the 3 regex option, the nature of Perl's regex en

Regexp to remove spaces

2009-12-20 Thread sftriman
I use this series of regexp all over the place to clean up lines of text: $x=~s/^\s+//g; $x=~s/\s+$//g; $x=~s/\s+/ /g; in that order, and note the final one replace \s+ with a single space. Basically, it's (1) remove all leading space, (2) remove all trailing space, and (3) replace all multi-spa

Faster way to do a regexp using a hash

2009-12-20 Thread sftriman
I've been wondering for a long time... is there a slick (and hopefully fast!) way to do this? foreach (keys %fixhash) { $x=~s/\b$_\b/$fixhash{$_}/gi; } So if $x="this could be so cool" and $fixhash{"could"}="would"; $fixhash{"COOL"}="awesome"; $fixhash{"beso"}="nope"; $fixhash{"his"}="impo