Re: fork, parallel and global values

2010-05-11 Thread raphael()
On Tue, May 11, 2010 at 1:59 AM, Eric Veith1 eric.ve...@de.ibm.com wrote: raphael() raphael.j...@gmail.com wrote on 05/10/2010 04:07:58 PM: I want to do work on all elements of an array simultaneously. To clarify: You want to access an hash defined in the parent process from all N child

Re: IMAP email client: style security

2010-05-11 Thread Eitan Adler
I made the changes below and I'd like to know if there is anything else I could do to improve the quality of my code. use constant false = 0; use constant true = 1; Constants are usually written in all uppercase to distinguish them from keywords, functions, operators and

Re: IMAP email client: style security

2010-05-11 Thread Uri Guttman
EA == Eitan Adler li...@eitanadler.com writes: Constants are usually written in all uppercase to distinguish them from keywords, functions, operators and subroutines. How did you choose the arbitrary values 0 and 1 for false and true instead of using other values? Why did you name

fork, read from child process and timeout

2010-05-11 Thread Weizhong Dai
Hi all, - $pid = open(README, program arguments |) or die Couldn't fork: $!\n; while (README) { # ... } close(README) -- my problem is: I read from README, but if waiting for next input is timeout, end reading. Is there any

Re: How to use the module: XML::Parser

2010-05-11 Thread Jeff Pang
2010/5/11 Parag Kalra paragka...@gmail.com: Hey All, I am trying to design some scripts using the module - XML::Parser To start  learning I have a very basic scenario. Suppose I have following XML file: root tag1My Tag1/tag1 tag2My Tag2/tag2 tag3My Tag3/tag3 /root I want to save the

Re: fork, read from child process and timeout

2010-05-11 Thread Jeff Pang
2010/5/11 Weizhong Dai weizhong@gmail.com: Hi all, - $pid = open(README, program arguments |)  or die Couldn't fork: $!\n; while (README) {    # ... } close(README) -- my problem is: I read from README, but if  waiting

Re: IMAP email client: style security

2010-05-11 Thread Eitan Adler
perl style is to just use boolean tests and not check for equality to some constants. and this means not using FALSE and TRUE constants. so you should drop this habit as you won't see it much in perl. Alright - changed. This is exactly why I sent this email to the list - to learn perl style.

AW: fork, read from child process and timeout

2010-05-11 Thread Thomas Bätzler
Weizhong Dai weizhong@gmail.com asked: - $pid = open(README, program arguments |) or die Couldn't fork: $!\n; while (README) { # ... } close(README) -- my problem is: I read from README, but if waiting for next

Re: How to use the module: XML::Parser

2010-05-11 Thread Shlomi Fish
Hi Parag, On Tuesday 11 May 2010 08:50:21 Parag Kalra wrote: Hey All, I am trying to design some scripts using the module - XML::Parser To start learning I have a very basic scenario. Suppose I have following XML file: root tag1My Tag1/tag1 tag2My Tag2/tag2 tag3My Tag3/tag3 /root

UTF-8 and Internal Representation of (Latin1) Characters

2010-05-11 Thread Peter Daum
Because I had little need for it I had tried to just ignore Perl's Unicode support as long as possible. Now it looks like I can't do that anymore, so I started looking through the various docs. One thing that confused me: several sources mention Perl using 8-bit characters as long as possible,

sort hash with an array as the value

2010-05-11 Thread Owen
I have this statement; foreach my $key ( keys %filehash ) { print $key $filehash{$key}-[0]\t\t\t$filehash{$key}-[3]\t $filehash{$key}-[2]\t $filehash{$key}-[1]\n; } but wish to sort the output by $filehash{$key}-[0]. Is it possible? How do I do this? I can't make a separate hash of the

AW: sort hash with an array as the value

2010-05-11 Thread Thomas Bätzler
Owen rc...@pcug.org.au asked: I have this statement; foreach my $key ( keys %filehash ) { print $key $filehash{$key}-[0]\t\t\t$filehash{$key}-[3]\t $filehash{$key}-[2]\t $filehash{$key}-[1]\n; } but wish to sort the output by $filehash{$key}-[0]. Is it possible? How do I do this?

Re: sort hash with an array as the value

2010-05-11 Thread Shlomi Fish
Hi Owen, On Tuesday 11 May 2010 14:10:49 Owen wrote: I have this statement; foreach my $key ( keys %filehash ) { print $key $filehash{$key}-[0]\t\t\t$filehash{$key}-[3]\t $filehash{$key}-[2]\t $filehash{$key}-[1]\n; } but wish to sort the output by $filehash{$key}-[0]. Is it

Re: Remove and substitute character in a string with a regex

2010-05-11 Thread C.DeRykus
On May 10, 3:53 am, shlo...@iglu.org.il (Shlomi Fish) wrote: Hi Thomas, a few comments on your code. On Monday 10 May 2010 13:45:53 Thomas Bätzler wrote: Finalfire blog.h...@gmail.com asked: Hello guys! I'm skilling regex using Perl and i've some trouble about a simple try: i've

Re: AW: AW: Remove and substitute character in a string with a regex

2010-05-11 Thread Dr.Ruud
Thomas Bätzler wrote: (attribution fixed) Shlomi Fish: use warnings is preferable to the -w flag. Not in my book. The command line switch turns on warnings globally, whereas the use warnings; pragma only enables them in the current lexical scope. So by using the command line switch, I get

Re: Remove and substitute character in a string with a regex

2010-05-11 Thread C.DeRykus
On May 9, 10:03 am, blog.h...@gmail.com (Finalfire) wrote: Hello guys! I'm skilling regex using Perl and i've some trouble about a simple try: i've a string like: $string = HELLAAABB; and i want to manipulate in that way: HELL4O3ABB4C;You can simply notice that when i have 3 or

Re: Closing File Handles

2010-05-11 Thread Whacky™
On Apr 30, 9:30 pm, jcas...@activenetwerx.com (Joseph L. Casale) wrote: Is it required to manually close a file handle I used to write debugging info to when the Perl scripts exits? Seems like a waste of effort at the end of the script to test `if debug...` and close the fh after? Thanks!

Developing Complex Event Processing (CEP) applications in perl

2010-05-11 Thread Amit Saxena
Hello all, Please let me know if anybody has any idea on the development of Complex Event Processing (CEP) applications in perl. I have been assigned a task for development of a complex event processing (CEP) application and I would like to do the same in perl that is my favorite language.

Re: fork, parallel and global values

2010-05-11 Thread C.DeRykus
On May 10, 7:07 am, raphael.j...@gmail.com (raphael()) wrote: Hello, -- CODE -- #!/usr/bin/env perl use strict; use warnings; use Parallel::ForkManager; # Parallel::ForkManager my $pfm = Parallel::ForkManager-new(5); my %hash; for my $num ( qw/ 1 2 3 4 5 1 / ) {    

Re: Developing Complex Event Processing (CEP) applications in perl

2010-05-11 Thread Jeff Pang
2010/5/11 Amit Saxena learn.tech...@gmail.com: Hello all, Please let me know if anybody has any idea on the development of Complex Event Processing (CEP) applications in perl. Maybe POE is your friend: http://poe.perl.org/ -- Tech support agency in China http://duxieweb.com/ -- To

Re: Still pondering working with hashs

2010-05-11 Thread Harry Putnam
Shawn H Corey shawnhco...@gmail.com writes: Harry Putnam wrote: But, is there an easier way? Invert both hashes and find the keys in both inverses. Shawn, hoping to pester you once more about this topic. first: Hashes involved are built like this (Using File::Find nomenclature): (NOT

Re: Still pondering working with hashs

2010-05-11 Thread Jim Gibson
On 5/11/10 Tue May 11, 2010 1:52 PM, Harry Putnam rea...@newsguy.com scribbled: Shawn H Corey shawnhco...@gmail.com writes: Harry Putnam wrote: But, is there an easier way? Invert both hashes and find the keys in both inverses. Shawn, hoping to pester you once more about this topic.

Re: Remove and substitute character in a string with a regex

2010-05-11 Thread C.DeRykus
On May 10, 5:29 am, t.baetz...@bringe.com (Thomas Bätzler) wrote: Hi Shlomi, use warnings is preferable to the -w flag. Not in my book. The command line switch turns on warnings globally, whereas the use warnings; pragma only enables them in the current lexical scope. So by using the

Re: Still pondering working with hashs

2010-05-11 Thread Shawn H Corey
On 10-05-11 04:52 PM, Harry Putnam wrote: Some selective output first: [...] d1 ./dir1/etc/images/gnus/exit-summ.xpm d2(1) ./dir2/etc/images/gnus/exit-summ.xpm d1 ./dir1/etc/images/gnus/reply.xpm d2(1) ./dir2/etc/images/mail/reply.xpm d2(2)

Re: Still pondering working with hashs

2010-05-11 Thread Harry Putnam
Jim Gibson jimsgib...@gmail.com writes: Harry wrote: Shawn, hoping to pester you once more about this topic. Jim G responded: It is not fair to single out Shawn for help. Just post your question and hope for a response. Just a manner of speaking, but you're right it does appear to be a

Re: Still pondering working with hashs

2010-05-11 Thread Harry Putnam
Shawn H Corey shawnhco...@gmail.com writes: Oh nice... thanks. Hope I can get to try this out later tonight... I have to go out for a while and can't get to it right now though. The main `for loop' near the end, and really, all of it, looks to be highly portable like the inversion code was