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
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;
>
>
>
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
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
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
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
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;
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
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):
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
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
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
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
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
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
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
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: [
"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
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?
>
> -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
>
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 )
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
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
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:
>
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
25 matches
Mail list logo