Re: fork question

2006-07-21 Thread John W. Krahn
Travis Thornhill wrote: > I thought I understood this but maybe I don't. Have you read the perlipc doc: perldoc perlipc It has examples on how to use fork. > When perl forks it creates an exact copy of itself with open files, same > variables, hashes, arrays, etc. > > But when a variable in

fork question

2006-07-21 Thread Travis Thornhill
I thought I understood this but maybe I don't. When perl forks it creates an exact copy of itself with open files, same variables, hashes, arrays, etc. But when a variable in one changes, do they all change? What's wrong with how I'm trying to use the $children variable to track

RE: MySQL question

2006-07-21 Thread Venkat Saranathan
If you have MySQL 5.0 or greater, you will be able to create a stored procedure and call it from DBI. with warm regards, Venkat Saranathan Gulf Breeze Software www.gulfsoft.com GulfBreeze Blog www.gulfsoft.com/blog -Original Message- From: Karjala [mailto:[EMAIL PROTECTED] Sent: Frid

Re: using 'negative look-ahead' assertions

2006-07-21 Thread John W. Krahn
[EMAIL PROTECTED] wrote: > I'm trying to get all files of a directory whose name does not end with a > particular string. > > I'm tried using: > @files = readdir DIR; > @otherfiles = grep /(?!java)/, @files; my @otherfiles = grep !/java\z/, @files; > but files with java in them are returned al

RE: using 'negative look-ahead' assertions

2006-07-21 Thread Timothy Johnson
If you really just want everything that doesn't match, do it like this: if($string !~ /pattern/){ do something... } -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Friday, July 21, 2006 5:52 PM To: beginners@perl.org Subject: using 'negative look-

using 'negative look-ahead' assertions

2006-07-21 Thread Jhst463
I'm trying to get all files of a directory whose name does not end with a particular string. I'm tried using: @files = readdir DIR; @otherfiles = grep /(?!java)/, @files; but files with java in them are returned along with the other files. I'd like to know, in general, how to get everything tha

MySQL question

2006-07-21 Thread Karjala
Maybe I should ask this question on a database list, but it's related to DBI, so I'm asking here also: I have a field in a record in the MySQL database that contains a number. I increase it by one with $dbh->do("update table set myfield = myfield + 1 where mykey = 10"); I was wondering wheth

Re: get only filenames and not directory names under a specific path.

2006-07-21 Thread Nishi Bhonsle
That works like a charm, thanks! -Nishi. On 7/21/06, Wagner, David --- Senior Programmer Analyst --- WGO < [EMAIL PROTECTED]> wrote: Nishi Bhonsle wrote: > I tried it but didnt work. > my @new; > > find(sub {push @new, $_}, $path); find(sub {push(@new,$_) if ( !/^\.{1,2}/ ) }, $path);

RE: get only filenames and not directory names under a specific path.

2006-07-21 Thread Wagner, David --- Senior Programmer Analyst --- WGO
Wagner, David --- Senior Programmer Analyst --- WGO wrote: > Nishi Bhonsle wrote: >> I tried it but didnt work. >> my @new; >> >> find(sub {push @new, $_}, $path); > find(sub {push(@new,$_) if ( !/^\.{1,2}/ ) }, $path); > > If not 1 or 2 periods push on to @new; > Wags ;) So

RE: get only filenames and not directory names under a specific path.

2006-07-21 Thread Wagner, David --- Senior Programmer Analyst --- WGO
Nishi Bhonsle wrote: > I tried it but didnt work. > my @new; > > find(sub {push @new, $_}, $path); find(sub {push(@new,$_) if ( !/^\.{1,2}/ ) }, $path); If not 1 or 2 periods push on to @new; Wags ;) > > open FILE,">>$logfile"; > > print FILE "$_\n" foreach @new; > close FI

Re: get only filenames and not directory names under a specific path.

2006-07-21 Thread Nishi Bhonsle
I tried it but didnt work. my @new; find(sub {push @new, $_}, $path); open FILE,">>$logfile"; print FILE "$_\n" foreach @new; close FILE; In addition to printing filenames and directories, it also printed the "." The log file contained . file1.txt file2.txt How can I not include the "." ?

Re: passing an array to subroutines

2006-07-21 Thread Mumia W.
On 07/21/2006 03:14 PM, [EMAIL PROTECTED] wrote: How do I pass an array to a subroutine in a manner that the array is entirely contained in one element of @_, instead of having each element mapped to elements of @_. for example, inside of the subroutine, I'd like to say @z = @_[0]; and have @

Re: Can't use an undefined value as a HASH reference at

2006-07-21 Thread Mumia W.
On 07/21/2006 02:08 PM, Jerry DuVal wrote: When trying to use the class below I keep getting this error message. Any idea's, I have tried everything. Can't use an undefined value as a HASH reference at /usr/share/perl5/Pace/Sockets/Client.pm line 37. [...] sub start1

Re: passing an array to subroutines

2006-07-21 Thread Xavier Mas i Ramón
A Divendres 21 Juliol 2006 22:14, [EMAIL PROTECTED] va escriure: > How do I pass an array to a subroutine in a manner that the array is > entirely contained in one element of @_, instead of having each element > mapped to elements of @_. > > for example, inside of the subroutine, I'd like to say >

Re: passing an array to subroutines

2006-07-21 Thread Joshua Colson
On Fri, 2006-07-21 at 16:14 -0400, [EMAIL PROTECTED] wrote: > How do I pass an array to a subroutine in a manner that the array is entirely > contained in one element of @_, instead of having each element mapped to > elements of @_. > > for example, inside of the subroutine, I'd like to say > @

passing an array to subroutines

2006-07-21 Thread Jhst463
How do I pass an array to a subroutine in a manner that the array is entirely contained in one element of @_, instead of having each element mapped to elements of @_. for example, inside of the subroutine, I'd like to say @z = @_[0]; and have @z refer to the entire array I passed to the subrout

Can't use an undefined value as a HASH reference at

2006-07-21 Thread Jerry DuVal
When trying to use the class below I keep getting this error message. Any idea's, I have tried everything. Can't use an undefined value as a HASH reference at /usr/share/perl5/Pace/Sockets/Client.pm line 37. ERROR - Aborting abnormally... error code = 2 message = Can't use an undefined value

Re: another error handling question

2006-07-21 Thread Stephen Kratzer
On Friday 21 July 2006 12:24, Jerry DuVal wrote: > Any way to catch a die message? I want to catch a die message from a sub > routine, log it, and continue with a different sub routine. > > > > Thanks in advance, > > > > Jerry You could call the subroutine from an eval block and check the value of

RE: another error handling question

2006-07-21 Thread Jeff Peng
Any way to catch a die message? I want to catch a die message from a sub routine, log it, and continue with a different sub routine. Hello.You could redefined the SIGDIE handler,point it to the reference of a subroutine (or an anonymous subroutine).In this subroutine,you could do the thing

Re: another error handling question

2006-07-21 Thread Tom Phoenix
On 7/21/06, Jerry DuVal <[EMAIL PROTECTED]> wrote: Any way to catch a die message? Perl has two common ways to do this: with an eval block and with the $SIG{'__DIE__'} mechanism; both are covered in the perlfunc entry about die. Hope this helps! --Tom Phoenix Stonehenge Perl Training -- To

Re: Create Snapshot of website

2006-07-21 Thread Mike Blezien
Zentara, - Original Message - From: "zentara" <[EMAIL PROTECTED]> To: Sent: Friday, July 21, 2006 11:16 AM Subject: Re: Create Snapshot of website On Thu, 20 Jul 2006 19:35:21 -0500, [EMAIL PROTECTED] ("Mike Blezien") wrote: I been trying to research the feasibility of using Perl a

another error handling question

2006-07-21 Thread Jerry DuVal
Any way to catch a die message? I want to catch a die message from a sub routine, log it, and continue with a different sub routine. Thanks in advance, Jerry

Re: how to add a list of numbers

2006-07-21 Thread tom arnall
On Thursday 20 July 2006 12:27 pm, Charles K. Clarkson wrote: > tom arnall wrote: > : Whatever happened to good old: > : > : my (@data,$result); > > Why declare these ... > > : @number = (1,2,3); > : $sum = 0; > > And then use these? > > Go ahead. Hit yourself upside the hea

RE: check existence of element in a list

2006-07-21 Thread Smith, Derek
-Original Message- From: joseph [mailto:[EMAIL PROTECTED] Sent: Thursday, July 20, 2006 6:45 PM To: beginners@perl.org Subject: Re: check existence of element in a list > > s/\s+$// foreach @pclist; > s/\s+$// foreach @smsclient; > > instead of using chomp(). If this also fails, the

Re: foreach loop

2006-07-21 Thread Stephen Kratzer
On Friday 21 July 2006 08:59, Sayed, Irfan (Irfan) wrote: > Hi, > > I am executing following code. > > foreach (@vob_repl_list) > > { > > print $_; > > `$MT chreplica -host puvob02 $_`; > > } > > but I am not getting the value of $_ in the command `$MT chreplica -host > puvob02 $_`; if I print the

foreach loop

2006-07-21 Thread Sayed, Irfan \(Irfan\)
Hi, I am executing following code. foreach (@vob_repl_list) { print $_; `$MT chreplica -host puvob02 $_`; } but I am not getting the value of $_ in the command `$MT chreplica -host puvob02 $_`; if I print the value of $_ then it's printing fine. but in command it's not taking that value. so

Re: Create Snapshot of website

2006-07-21 Thread dlentz
Mike Blezien <[EMAIL PROTECTED]> said: > Hello, > > I been trying to research the feasibility of using Perl and/or special module(s) > that can capture a website page and create a "snapshot" of the website page, or > like a thumbnail image. I've seen this done, but not sure if it can be done >

Re: Singleton

2006-07-21 Thread Rob Dixon
Klaus Jantzen wrote: > Hi, > > in the paper "The Singleton Design Pattern" by b. d. foy [The Perl > Review (0,1) p.19] the constructor > (listing 1, line 12) says > >> $singleton = bless \$self, $class; << > i.e. it uses the reference to $self whereas in other documentation I > always find > >>

Singleton

2006-07-21 Thread Klaus Jantzen
Hi, in the paper "The Singleton Design Pattern" by b. d. foy [The Perl Review (0,1) p.19] the constructor (listing 1, line 12) says >> $singleton = bless \$self, $class; << i.e. it uses the reference to $self whereas in other documentation I always find >> bless $self, $class; << i.e. $self

Re: Putting file content into an array

2006-07-21 Thread Mumia W.
On 07/21/2006 01:24 AM, Sayed, Irfan (Irfan) wrote: Hi, I need to read a specific file and put the each line of that file into an array. I mean first line will go to the first position of the array , second line [should] go to the second position of the array and so on. How do i do that ? Ple

Re: get only filenames and not directory names under a specific path.

2006-07-21 Thread Rob Dixon
Nishi Bhonsle wrote: Hi: I am starting a new thread based of an older thread just because there was a lot of different things that were requested for and it had gotten a bit confusing. I got a lot of help from all you experts to write the below code that takes an argument path C:\build\Sample\

Re: Polluting the Global Namespace

2006-07-21 Thread Shane Calimlim
Thanks everyone for the help, this is exactly what I needed. On 7/20/06, Tom Phoenix <[EMAIL PROTECTED]> wrote: On 7/20/06, Shane Calimlim <[EMAIL PROTECTED]> wrote: > I'd like to add some sub routines to the global namespace. I know this is > usually considered bad design for modules, but I

Re: sorting a nested array?

2006-07-21 Thread Mumia W.
On 07/20/2006 07:07 PM, Alan Campbell wrote: ello folks, ...got a bit carried away with references & deeply nested structures. Net result is I have an array of the form: - $ref<- reference to nested array [0] <- nothin