convert an array to hash

2002-11-28 Thread Ramprasad A Padmanabhan
Which is the quickest way of converting an array to hash keys I have an array @ARRAY = qw ( a b c d e ); # Convert array to hash keys , so can easily check for exists # The values of the hash are immaterial to me @HASH{@ARRAY}=@ARRAY; foreach (@SOME_OTHER_ARRAY) { next if(exists($HAS

Re: convert an array to hash

2002-11-28 Thread Paul Johnson
Ramprasad A Padmanabhan said: > Which is the quickest way of converting an array to hash keys > > I have an array > @ARRAY = qw ( a b c d e ); > > # Convert array to hash keys , so can easily check for exists > # The values of the hash are immaterial to me > > @HASH{@ARRAY}=@ARRAY; > > >

Re: convert an array to hash

2002-11-28 Thread Sudarshan Raghavan
On Thu, 28 Nov 2002, Ramprasad A Padmanabhan wrote: > Which is the quickest way of converting an array to hash keys > > I have an array > @ARRAY = qw ( a b c d e ); > > # Convert array to hash keys , so can easily check for exists > # The values of the hash are immaterial to me > > @HASH{@ARRAY

RE: alarm function not working

2002-11-28 Thread Juban, Nix
ok, i tried in UNIX and got no more errors but it doesnt expire after 30 seconds as expected. -Original Message-From: Timothy Johnson [mailto:[EMAIL PROTECTED]]Sent: Thursday, November 28, 2002 3:38 PMTo: 'Juban, Nix'; '[EMAIL PROTECTED]'Subject: RE: alarm function not worki

Re: convert an array to hash

2002-11-28 Thread Ramprasad A Padmanabhan
No I did not mean to say I was finding this way as slow . But It has happened so many times before that there have been better ways to do things which I have been doing and many of them were so commonplace that I am suprised they didnt occur to me . So I just wanted to make sure I was not go

RE: how do i make a script run for a certain period of time?

2002-11-28 Thread NYIMI Jose (BMB)
I'm writing a script that has to be automatically executed every day at 6:00 AM via 'dollar universe' scheduler software. I want my script to stop itself at 23:00 PM (I think to timeout via alarm function). The script is mainly a while(1) loop and I want my loop to sleep few seconds before going to

RE: alarm function not working

2002-11-28 Thread Paul Johnson
Juban, Nix said: > ok, i tried in UNIX and got no more errors but it doesnt expire after 30 > seconds as expected. By whom ;-) > ##!/usr/intel/bin/perl -w > use strict; > use warnings; > > my $time_to_die=0; > my $timeout=30; #in seconds > my @e=qw(| \ - /); > $SIG{ALRM} = sub { $time_to_die=1;

HELP W. Print

2002-11-28 Thread [EMAIL PROTECTED]
Hi, How do i solve this Say i have an variable $number witch has the integer value of 16.526899874 I wan to print it formatted like 16.52 (only 2 decimals) How do i do this with the basic print "$number"; command? Is there an "format string" like ##.## ? Thanks in advance -- To unsubscribe, e-ma

Weekly list FAQ posting

2002-11-28 Thread casey
NAME beginners-faq - FAQ for the beginners mailing list 1 - Administriva 1.1 - I'm not subscribed - how do I subscribe? Send mail to <[EMAIL PROTECTED]> You can also specify your subscription email address by sending email to (assuming [EMAIL PROTECTED] is your email address):

daemons

2002-11-28 Thread Mailing lists
Hi ppl... this is my first post, so i really do not know if this one is out of topic... i suppose it ain't anyway. THE TARGET: Well, i gotta write a daemon for my unix box in perl, it must be SUIDed so that it could write in the /etc directory. THE PROBLEM: I haven't ever written any daemon, so i

Repeating Regexp

2002-11-28 Thread Paul Murphy
Hello, this is a two part question: a how to, and a how best to. I have a string of numbers: "2329238023089823" And I want insert a space after each number. I can see how to insert after the first: s/(\d)/$1 / Can any one tell me how I can get the regexp to continue through the string and

RE: daemons

2002-11-28 Thread NYIMI Jose (BMB)
There are some modules from CPAN (http://search.cpan.org/) you can use. I would suggest: 1. Net::Daemon http://search.cpan.org/author/JWIED/Net-Daemon-0.37/lib/Net/Daemon.pm 2. give a look to Net::Server as well, for general purpose. http://search.cpan.org/author/RHANDOM/Net-Server-0.84/lib/Net

Re: Repeating Regexp

2002-11-28 Thread Jean Padilla
Hello, I suggest this: #!/usr/bin/perl -w use strict; my $var1 = "23456789"; my $var2; ($var2 = $var1) =~ s/(\d)/$1 /g; # only add 'g' for global substitution print "var1 = '$var1', var2 = '$var2'\n"; Regards. Paul Murphy a écrit : > > Hello, this is a two part question: a how to, and a how

Re: Repeating Regexp

2002-11-28 Thread Paul Johnson
Paul Murphy said: > > > Hello, this is a two part question: a how to, and a how best to. > > I have a string of numbers: > > "2329238023089823" > > And I want insert a space after each number. I can see how to insert > after the first: > > s/(\d)/$1 / > > Can any one tell me how I can get the reg

Re: Repeating Regexp

2002-11-28 Thread Paul Murphy
Thanks for the answers I got for this one. There was a bit of a resounding "doh!" when I saw the "just add g" answer. I must have read about this a million times before, but those brain cells just failed to activate when I was trying to do this yesterday. Paul. You wrote: > >Paul Murphy

Re: Repeating Regexp

2002-11-28 Thread Rob Dixon
Paul Another option you may like, which uses the convenient way that Perl stringifies arrays, with a space between each pair of elements. It does mean that you need a temporary array variable though: my @a = split "", "2329238023089823"; print "@a"; will output 2 3 2 9 2 3 8 0 2 3

searching for a range of accented characters

2002-11-28 Thread KAVANAGH, Michael
Hi there, In a regular expression, \w doesn't match any accented characters (áéíóú)... does anyone know of a range or easy way I can specify matches on these characters? Any ideas would be very helpful. Thanks Mike -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [

Re: searching for a range of accented characters

2002-11-28 Thread anthony
"Michael Kavanagh" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hi there, In a regular expression, \w doesn't match any accented characters (áéíóú)... does anyone know of a range or easy way I can specify matches on these characters? Any ideas would be very h

Re: HELP W. Print

2002-11-28 Thread Michael Kelly
On Thu, Nov 21, 2002 at 04:57:03PM -0200, [EMAIL PROTECTED] wrote: > Hi, Hi, > How do i solve this > Say i have an variable $number witch has the integer value of 16.526899874 > I wan to print it formatted like 16.52 (only 2 decimals) > How do i do this with the basic print "$number"; command? >

RE: HELP W. Print

2002-11-28 Thread NYIMI Jose (BMB)
> -Original Message- > From: Michael Kelly [mailto:[EMAIL PROTECTED]] > Sent: Thursday, November 28, 2002 9:20 PM > To: Perl Beginners List > Subject: Re: HELP W. Print > > > On Thu, Nov 21, 2002 at 04:57:03PM -0200, [EMAIL PROTECTED] wrote: > > Hi, > > Hi, > > > How do i solve this >

E-mail manipulation

2002-11-28 Thread Marcelo
Hi, I have a Linux mail server using and I need a script for manipulate the headers of the incoming mail before delivery, I need to verify if the incoming e-mail have an attachment and then I have to manipulate the subject...I also have to store the values of these headers (From, To, Subject )

Re: searching for a range of accented characters

2002-11-28 Thread John W. Krahn
Michael Kavanagh wrote: > > Hi there, Hello, > In a regular expression, \w doesn't match any accented characters (áéíóú)... > does anyone know of a range or easy way I can specify matches on these > characters? $ perl -le'use locale; $_ = "áéíóú"; print for /\w/g' á é í ó ú perldoc locale perl

limiting resource in regex matching

2002-11-28 Thread David Garamond
i'm creating a web interface for users to add their own mail filtering rules. the rules allow them to specify regexes to match headers and mail body. however, i'm a little concerned with how users can accidentally/ intentionally use too complex regexes like this "(a+.*(b+.+(c*.+)*.*))*" and the

Re: limiting resource in regex matching

2002-11-28 Thread simran
very interesting question... i can't wait to hear a solution myself if anyone out there knows of one... you might want to put the regex inside an "alarm/eval" block anyway so that at least you can limit the maximum time it takes... simran. On Fri, 2002-11-29 at 13:48, David Garamond wrote: >

Re: E-mail manipulation

2002-11-28 Thread Ramprasad A Padmanabhan
How do you propose to trap the mail before delivery ? If you are using a milter ( Sendmail::Milter ) then you will get all headers in the header call back. It would however be unwise to parse the entire mail for the sake of the headers. In case, however , you are using an intermediate progra