Re: fork, parallel and global values

2010-05-10 Thread raphael()
On Tue, May 11, 2010 at 1:59 AM, Eric Veith1 wrote: > "raphael()" 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 processes? > > I'm sorry to tell you, b

How to use the module: XML::Parser

2010-05-10 Thread Parag Kalra
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: My Tag1 My Tag2 My Tag3 I want to save the the tags as the keys of a Hash and respective content as the value of that hash So for th

Re: fork, parallel and global values

2010-05-10 Thread Eric Veith1
"raphael()" 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 processes? I'm sorry to tell you, but this won't work so easily. When forking, data is *copied*. Whic

Re: IMAP email client: style & security

2010-05-10 Thread John W. Krahn
Eitan Adler wrote: I wrote a program to fetch email from a IMAP account, look to see if I sent it, if yes execute any commands in the email and email the results back to via a SMTP server. 1) This being my first perl program I'd like to know if I'm using the proper perl idioms and language featu

Re: how to arrange a default action in a dispatch table

2010-05-10 Thread Harry Putnam
"John W. Krahn" writes: > Because /\A\d+\z/ has less ambiguity then /^\d+$/. "Dr.Ruud" writes: > And /\A[0-9]+\z/ is probably what was really meant. Got it, and thank you both. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.or

Re: Using # instead of / as REGEX search delimiter

2010-05-10 Thread Vimal Kumar
Thanks Steve, That did the trick! Going through 'perldoc perlop' now :-) On Mon, May 10, 2010 at 9:16 PM, Steve Bertrand wrote: > On 2010.05.10 11:25, Vimal Kumar wrote: > > Hi all, > > > > I am relatively new to Perl. Was learning references and thought of > creating > > a script that will list

Re: Using # instead of / as REGEX search delimiter

2010-05-10 Thread Steve Bertrand
On 2010.05.10 11:25, Vimal Kumar wrote: > Hi all, > > I am relatively new to Perl. Was learning references and thought of creating > a script that will list the username and its list of domains from httpd.conf > (on a cpanel server). I am curious to know why line > > if (/DocumentRoot \/home\/(\S

Using # instead of / as REGEX search delimiter

2010-05-10 Thread Vimal Kumar
Hi all, I am relatively new to Perl. Was learning references and thought of creating a script that will list the username and its list of domains from httpd.conf (on a cpanel server). I am curious to know why line if (/DocumentRoot \/home\/(\S+?)\//) { works whereas if (#DocumentRoot /home/(\S+

fork, parallel and global values

2010-05-10 Thread raphael()
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 / ) { $pfm->start and next; $hash{$num}++; $pfm->finish; } $pfm->wait_

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

2010-05-10 Thread Thomas Bätzler
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 command line switch, I get warnings about crappy third-party code, too.

Re: Patching a binary file

2010-05-10 Thread Dr.Ruud
Chap Harrison wrote: I need to search a binary file using a regex, and replace a 20-byte string with another 20-byte string (binary). The FAQ talks about "perl -pi -e 's/foo/bar/g' myfile", but given that I'm dealing with binary, and that I want to do this from within a larger script, that

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

2010-05-10 Thread Shlomi Fish
Hi Thomas, a few comments on your code. On Monday 10 May 2010 13:45:53 Thomas Bätzler wrote: > Finalfire asked: > > 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 manip

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

2010-05-10 Thread Thomas Bätzler
Finalfire asked: > 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 more occurrences of a character,

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

2010-05-10 Thread Shawn H Corey
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 more occurrences of a character, i want to subst

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

2010-05-10 Thread Shlomi Fish
Hi Finalfire, On Sunday 09 May 2010 20:03:44 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

Re: how to arrange a default action in a dispatch table

2010-05-10 Thread Dr.Ruud
John W. Krahn wrote: /\A\d+\z/ has less ambiguity then /^\d+$/. And /\A[0-9]+\z/ is probably what was really meant. -- Ruud -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Remove and substitute character in a string with a regex

2010-05-10 Thread Finalfire
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 more occurrences of a character, i want to substitute all the occur

AW: IMAP email client: style & security

2010-05-10 Thread Thomas Bätzler
Eitan Adler wrote: > I wrote a program to fetch email from a IMAP account, look to see if I > sent it, if yes execute any commands in the email and email the results > back to via a SMTP server. [...] > 2) Secondly since this program executes commands from a potentially > insecure source I'd like

IMAP email client: style & security

2010-05-10 Thread Eitan Adler
I wrote a program to fetch email from a IMAP account, look to see if I sent it, if yes execute any commands in the email and email the results back to via a SMTP server. 1) This being my first perl program I'd like to know if I'm using the proper perl idioms and language features. Is there anythin

cpan, (Makefile.PL modification time in future)

2010-05-10 Thread David Schmidt
Hello list I just attempted to upgrade my Catalyst modules and from 3 modules to upgrade only Catalyst::Runtime failed with this error msg. >Your installer Makefile.PL has a modification time in the future (1273266119 > >1273142317). > >This is known to create infinite loops in make. > >Please