[16533] in Perl-Users-Digest
Perl-Users Digest, Issue: 3945 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Aug 8 03:05:28 2000
Date: Tue, 8 Aug 2000 00:05:14 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <965718313-v9-i3945@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Tue, 8 Aug 2000 Volume: 9 Number: 3945
Today's topics:
Re: 5.00 > 5.6 (Keith Calvert Ivey)
Re: CGI.PM How to get all Form's value in a HashTable? (Keith Calvert Ivey)
Re: CGI.PM How to get all Form's value in a HashTable? (NP)
Re: CGI.PM How to get all Form's value in a HashTable? (brian d foy)
Re: Converting from US dates/numbers to European dates/ <tim@ipac.caltech.edu>
Re: Converting from US dates/numbers to European dates/ <godzilla@stomp.stomp.tokyo>
Re: Converting from US dates/numbers to European dates/ <waltman@netaxs.com>
Re: Different input_record_separator for different file <tim@ipac.caltech.edu>
Embedded spaces in arrays (Steve Leibel)
Re: Embedded spaces in arrays (Rafael Garcia-Suarez)
Re: find the number of characters in a string <lr@hpl.hp.com>
I need further clarity on rand() etc. <gorbeast@SPAMSUCKS.subduction.org>
Re: I need further clarity on rand() etc. <waltman@netaxs.com>
Re: Impossible RegEx Problem (Keith Calvert Ivey)
Re: Interesection and subtraction of data sets. (Keith Calvert Ivey)
Re: Mail::Mailer - multiple recipients? (Keith Calvert Ivey)
Re: Need explanation <tim@ipac.caltech.edu>
Re: negative zero? (Villy Kruse)
Re: Novice question: How to kill a process <tim@ipac.caltech.edu>
perl program running with cgi extension <jpcrisci@mailnwql.cr.usgs.gov>
Pop Ups (@)
Pop Ups (@)
question <unplug@poboxes.com>
Re: question (Rafael Garcia-Suarez)
Re: question <unplug@poboxes.com>
Re: reg expression query (Keith Calvert Ivey)
Re: reg expression query <tim@ipac.caltech.edu>
Re: Regular Expressions & Substitution (Keith Calvert Ivey)
Re: Sendmail delivery failures <timewarp@shentel.net>
Re: Simple reg expression question <kennylim@techie.net>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 08 Aug 2000 03:55:27 GMT
From: kcivey@cpcug.org (Keith Calvert Ivey)
Subject: Re: 5.00 > 5.6
Message-Id: <399782bc.7008137@news.newsguy.com>
Greymaus wrote:
>*** post for free via your newsreader at post.newsfeeds.com ***
[content snipped]
> **** Post for FREE via your newsreader at post.newsfeeds.com ****
>
>-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
>*** Newsfeeds.com - The #1 Usenet Newsgroup Service on The Planet! ***
>-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
> http://www.newsfeeds.com | http://www.newsfeeds.com
> |
>* Anonymous posting server! | * Totally Uncensored!
>* SUPER Servers! | * Over 80,000 Newsgroups!
>* BINARIES ONLY Servers! | * 16 seperate Newsgroup Servers!
>* SPAM FILTERED Server! | * Instant access!
>* ADULT ONLY Server! | * Multiple OC 3's and OC 12's!
>* MP3 ONLY Server! | * 99% Article Completion!
>* MULTIMEDIA ONLY Server! | * Months of Retention!
>* 7 UNCENSORED Newsgroup Servers | * Lightning FAST downloads!
> |
> http://www.newsfeeds.com | http://www.newsfeeds.com
>-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
> **** Point your newsreader to post.newsfeeds.com ****
>-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
What the hell!? And I thought the four-line spam sig
newsfeeds.com was adding to the end of my posts before I escaped
my ISP's news service was outrageous. If I didn't know better,
I'd assume this was some sort of forgery designed to make
newsfeeds.com look even worse than it is. This company must be
destroyed!
Greymaus, if you want anyone to pay attention to your posts
rather than the garbage surrounding them, leave newsfeeds.com
and go elsewhere. There are many reputable Usenet providers
that don't force their customers to spam for them.
--
Keith C. Ivey <kcivey@cpcug.org>
Washington, DC
------------------------------
Date: Tue, 08 Aug 2000 03:41:45 GMT
From: kcivey@cpcug.org (Keith Calvert Ivey)
Subject: Re: CGI.PM How to get all Form's value in a HashTable?
Message-Id: <39958104.6568073@news.newsguy.com>
nobull@mail.com wrote:
>How is the Vars() method defined? It's not a standard part of CGI.pm
>AFAIK. Seems like an unusual name for a method too.
Unfortunately, the POD that comes with CGI.pm is not as good as
the documentation at http://stein.cshl.org/WWW/CGI/. Vars() is
indeed part of CGI.pm, and it returns a hash when called in
array context (and a tied hash reference when called ina cslar
conference).
>Why is a hash table better than the CGI object itself?
Because a hash can be more convenient to deal with if you're
changing the values of your form variables. For example, you
can't do this:
param('card_number') =~ tr/0-9//cd;
--
Keith C. Ivey <kcivey@cpcug.org>
Washington, DC
------------------------------
Date: Tue, 08 Aug 2000 04:22:46 GMT
From: nvp@spamnothanks.speakeasy.org (NP)
Subject: Re: CGI.PM How to get all Form's value in a HashTable?
Message-Id: <qWLj5.448863$MB.6769779@news6.giganews.com>
On Tue, 08 Aug 2000 03:32:54 GMT, Keith Calvert Ivey <kcivey@cpcug.org> wrote:
: nobull@mail.com wrote:
:
: >How is the Vars() method defined? It's not a standard part of CGI.pm
: >AFAIK. Seems like an unusual name for a method too.
:
: Unfortunately, the POD that comes with CGI.pm is not as good as
: the documentation at http://stein.cshl.org/WWW/CGI/. Vars() is
: indeed part of CGI.pm, and it returns a tied hash reference, not
: a hash (as the original poster thought).
:
: >Why is a hash table better than the CGI object itself?
:
: Because a hash can be more convenient to deal with if you're
: changing the values of your form variables. For example, you
: can't do this:
:
: param('card_number') =~ tr/0-9//cd;
:
: --
: Keith C. Ivey <kcivey@cpcug.org>
: Washington, DC
--
Nathan Patwardhan
nvp@noopy.org
"The good place for all who are Noopies"
------------------------------
Date: Tue, 08 Aug 2000 01:43:50 -0400
From: brian@smithrenaud.com (brian d foy)
Subject: Re: CGI.PM How to get all Form's value in a HashTable?
Message-Id: <brian-ya02408000R0808000143500001@news.panix.com>
In article <39958104.6568073@news.newsguy.com>, kcivey@cpcug.org (Keith Calvert Ivey) posted:
> nobull@mail.com wrote:
> >How is the Vars() method defined? It's not a standard part of CGI.pm
> >AFAIK. Seems like an unusual name for a method too.
> Unfortunately, the POD that comes with CGI.pm is not as good as
> the documentation at http://stein.cshl.org/WWW/CGI/.
it's the same stuff, adjusted for version differences.
--
brian d foy
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
Perl Mongers <URL:http://www.perl.org/>
------------------------------
Date: Mon, 07 Aug 2000 22:15:45 -0700
From: Tim Conrow <tim@ipac.caltech.edu>
Subject: Re: Converting from US dates/numbers to European dates/numbers
Message-Id: <398F9781.CFED4FB5@ipac.caltech.edu>
bluearchtop@my-deja.com wrote:
>
> This is a dumb question, I'm sure, but anyway...
>
> Let's say I have an simple script:
>
> $a=1.23;
> $b=2.00;
> $c = $a + $b;
> print $c;
>
> This prints 3.23.
>
> Now, let's say I have to run this on a computer in France, where 1.23
> is actually 1,23.
>
> 1,23 + 2, would not work.
>
> Other than converting back and forth, are there any other options?
I don't use them myself, but I think you'd be lookin' for locales.
perdoc perllocale
--
-- Tim Conrow tim@ipac.caltech.edu 626-395-8435
------------------------------
Date: Mon, 07 Aug 2000 22:46:28 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Converting from US dates/numbers to European dates/numbers
Message-Id: <398F9EB4.3B7DDB42@stomp.stomp.tokyo>
bluearchtop@my-deja.com wrote:
> This is a dumb question, I'm sure, but anyway...
> Let's say I have an simple script:
Goodness, this style of preamble is sure becoming
quite popular these days. I read dozens of different
people using this unique style, frequently.
> $a=1.23;
> $b=2.00;
> $c = $a + $b;
> print $c;
> This prints 3.23.
> Now, let's say I have to run this on a computer in France,
> where 1.23 is actually 1,23.
> 1,23 + 2, would not work.
> Other than converting back and forth,
> are there any other options?
What other options are there than using a decimal
point for mathematical manipulation? I'm pretty sure
if you use an odd character for a decimal point, you
will encounter a common glitch; crash!
I am curious now. Are there machines programmed to
deal with a comma as a decimal point? This is sincere.
I really don't know having not visited the South of
France to work on no tanlines for a bit of time although
I do this daily at home, much to my telescope neighbor's
delight or is it disgust? Suppose age factors in.
To the best of my knowledge, mathematics work the same
all around our world and out to the deep fringes of
our Universe. However, proximity to a Black Hole may
cause rather interesting twists on number crunching.
I don't know if mathematics remain the same in other
universes out there in this black stuff called space.
Your French example, my presumption is you are referring
to user input considering mathematics is universally
consistent, even inside a math coprocessor on my home
world, Alturus 5 out in the Gamma sector. Another of
my presumptions is you are only dealing with common
two decimal places, such as in currency. Fairly simple
solution unless I am forgetting something. Inherently
if your user spends more than $999.99 American bucks
non-exchange rated, you will need to sprinkle some
commas here and there as needed, besides plugging
one in for decimal place. Test script below.
How do tanlineless cuties and studies write currency
amounts less than our equal to a dollar?
1¢ equals ,1 ??
Might be some hidden bugs with this you are not
taking into consideration beyond my semantic
double pun.
Are you asking about dates, numbers or both? Try to be
clear and concise with your topic. This vagueness does
seem a contagion lately albeit fun at times.
As to date conversion, strikes me this is just a matter
of adjusting to local time via GMT reference and, a simple
matter of translating a handful of words, oui?
Say, you like my new French perfume? Just bought it
today at K-Fart, designer label brand as well!
"Oui Oui Le Tomcat" Very noticable aroma!
Lets hope you don't elect to walk the length of
the Great Wall of China. Hmm.. kinda suspect
mathematics are quite the same there, as well.
Godzilla!
--
"Just Say NO! To Modules."
TEST SCRIPT:
____________
#!/usr/local/bin/perl
print "Content-Type: text/plain\n\n";
$french = "123,123,12";
print "French Input Number Is: $french \n\n";
if (${\substr ($french, -3, 1)} eq ",")
{
$decimal_it = substr ($french, -3, 1, ".");
$french =~ s/,//g;
}
else
{ print "Oh Fudge! Now what boss?"; exit; }
print "French Output Number Is: $french";
exit;
PRINTED RESULTS:
________________
French Input Number Is: 123,123,12
French Output Number Is: 123123.12
------------------------------
Date: 08 Aug 2000 01:32:27 -0400
From: Walt Mankowski <waltman@netaxs.com>
Subject: Re: Converting from US dates/numbers to European dates/numbers
Message-Id: <m3lmy8s4gk.fsf@netaxs.com>
bluearchtop@my-deja.com writes:
> This is a dumb question, I'm sure, but anyway...
>
> Let's say I have an simple script:
>
> $a=1.23;
> $b=2.00;
> $c = $a + $b;
> print $c;
>
> This prints 3.23.
>
> Now, let's say I have to run this on a computer in France, where 1.23
> is actually 1,23.
>
> 1,23 + 2, would not work.
>
> Other than converting back and forth, are there any other options?
perldoc perllocale
------------------------------
Date: Mon, 07 Aug 2000 22:02:37 -0700
From: Tim Conrow <tim@ipac.caltech.edu>
Subject: Re: Different input_record_separator for different files.
Message-Id: <398F946D.CBA558B0@ipac.caltech.edu>
Mike Van Pelt wrote:
>
> Is there a way to have a different input_record_separator for
> different open files?
>
> I'm trying to write a program for which one file needs to
> be read with a different input_record_separator than the other.
>
> ... [snip] ...
>
> Huh? Is there only one global input_record_separator for all
> open files? ...
Yes.
I know it's confusing because input_record_separator seems like it
operates per-instance, but it operates on IO "class data" (sort of; it's
really a global) rather than IO "instance data".
IMHO the docs are insufficiently clear about this. perlvar does document
it, but a few extra words to make it crystal clear wouldn't hurt.
--
-- Tim Conrow tim@ipac.caltech.edu 626-395-8435
------------------------------
Date: Mon, 07 Aug 2000 23:02:42 -0700
From: stevel@bluetuna.com (Steve Leibel)
Subject: Embedded spaces in arrays
Message-Id: <stevel-0708002302420001@192.168.100.2>
Can someone kindly point me to the fine print that explains the output of
this program:
#!/usr/local/bin/perl -w
use strict;
my @fish = ("tuna", "salmon");
print @fish, "\n";
print "@fish", "\n";
The output is
tunasalmon
tuna salmon
In other words, interpolating an array in double quotes causes spaces to
appear between the elements. Why is that?
Thanks,
Steve L
stevel@bluetuna.com
------------------------------
Date: Tue, 08 Aug 2000 06:12:38 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: Embedded spaces in arrays
Message-Id: <slrn8ov9gh.hgu.rgarciasuarez@rafael.kazibao.net>
Steve Leibel wrote in comp.lang.perl.misc:
>
>In other words, interpolating an array in double quotes causes spaces to
>appear between the elements. Why is that?
Look at the perlvar manpage, search for the $" variable.
--
Rafael Garcia-Suarez
------------------------------
Date: Mon, 7 Aug 2000 23:36:39 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: find the number of characters in a string
Message-Id: <MPG.13f902a35517278598ac47@nntp.hpl.hp.com>
In article <soukpj1j63a82@corp.supernews.com> on Tue, 08 Aug 2000
00:24:19 GMT, Craig Berry <cberry@cinenet.net> says...
> Godzilla! (godzilla@stomp.stomp.tokyo) wrote:
> : What method would you personally use to count letters?
>
> Given a string in $_:
>
> * To count the number of characters, I would use length.
> * To count the number of standard alphabet letters, I would use
> tr/A-Za-z//.
> * To count the number of letter characters, respecting the current
> locale, I would use s/([^\W\d_])/$1/g in scalar context.
Well, maybe. It's expensive any way you do it, but there are better
ways.
#!/usr/local/bin/perl -w
use strict;
use Benchmark;
use vars '$s';
$s = 'abcdefghijklmn0123456789';
timethese( 1 << (shift || 0), {
Length => 'my $x = length $s',
Letters => 'my $x = $s =~ tr/A-Za-z//',
Locale0 => 'my $x = $s =~ s/([^\W\d_])/$1/g',
Locale1 => 'my $x = () = $s =~ /[^\W\d_]/g',
Locale2 => 'my $x; ++$x while $s =~ /[^\W\d_]/g; $x',
} );
__END__
Output:
Benchmark: timing 65536 iterations of Length, Letters, Locale0, Locale1,
Locale2...
Length: -1 wallclock secs ( 0.19 usr + 0.00 sys = 0.19 CPU) @
350459.89/s(n=65536)
(warning: too few iterations for a reliable count)
Letters: 1 wallclock secs ( 0.36 usr + 0.00 sys = 0.36 CPU) @
182044.44/s(n=65536)
(warning: too few iterations for a reliable count)
Locale0: 9 wallclock secs ( 9.06 usr + 0.00 sys = 9.06 CPU) @
7231.96/s (n=65536)
Locale1: 7 wallclock secs ( 7.31 usr + 0.00 sys = 7.31 CPU) @
8962.80/s (n=65536)
Useless use of private variable in void context at (eval 10) line 1.
Locale2: 4 wallclock secs ( 5.28 usr + 0.00 sys = 5.28 CPU) @
12409.77/s (n=65536)
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Mon, 07 Aug 2000 21:20:04 -0700
From: Gorbeast <gorbeast@SPAMSUCKS.subduction.org>
Subject: I need further clarity on rand() etc.
Message-Id: <398F8A74.7A6BD03@SPAMSUCKS.subduction.org>
Hello,
For some reason I can't find an example of rand() on Deja that is suited
to what I am trying to do. What I need my script to do is
open(NAMES, names)
open(LASTNAMES, lastnames)
while (<FILE-TO-ACT-ON>) {
randomly pick an entry from NAMES
randomly pick an entry from LASTNAMES
print $_, $name, $lastname
}
In other words, foreach $_ randomly pick an entry from 2 different
files.
I tried the following examples without success.
first, the llama book has this this example:
--
#srand; -- not necessary with my version of perl supposedly
print "list of strings: "; @b = <STDIN>;
print "Answer: $b[rand(@b)]";
--
What I experience with this example is that it correctly grabs a random
line from my NAMES for the _first_ instance of $_, but then returns
undef for the rest of the list. Why?
The second example I looked at was the from the Perl Cookbook on
p.284-285, but I couldn't figure out how to adapt it to work properly
cause I am so newby. It either returned the same NAME for all instances
of $_ or just undef when I fiddled with it.
---
srand;
rand($.) < 1 && ($line = $_ ) while <>;
---
I could use your help/suggestions if you have it to spare. Thank you in
advance.
GJS
------------------------------
Date: 08 Aug 2000 01:29:54 -0400
From: Walt Mankowski <waltman@netaxs.com>
Subject: Re: I need further clarity on rand() etc.
Message-Id: <m3og34s4kt.fsf@netaxs.com>
Gorbeast <gorbeast@SPAMSUCKS.subduction.org> writes:
> Hello,
>
> For some reason I can't find an example of rand() on Deja that is suited
> to what I am trying to do. What I need my script to do is
>
> open(NAMES, names)
> open(LASTNAMES, lastnames)
>
> while (<FILE-TO-ACT-ON>) {
>
> randomly pick an entry from NAMES
> randomly pick an entry from LASTNAMES
> print $_, $name, $lastname
>
> }
>
> In other words, foreach $_ randomly pick an entry from 2 different
> files.
>
> I tried the following examples without success.
> first, the llama book has this this example:
>
> --
> #srand; -- not necessary with my version of perl supposedly
> print "list of strings: "; @b = <STDIN>;
> print "Answer: $b[rand(@b)]";
> --
>
> What I experience with this example is that it correctly grabs a random
> line from my NAMES for the _first_ instance of $_, but then returns
> undef for the rest of the list. Why?
Are you trying to run both of those commands for each line in
FILE-TO-ACT-ON? @b = <FH> loads the entire file associated with FH
and stores it in the array @b. It leaves FH at the end of the file,
so if you try to run the command again without either reopening or
rewinding FH you'll get undef.
Try this instead:
open (NAMES, $names);
@names = <NAMES>;
open (LASTNAMES, $lastnames);
@lastnames = <LASTNAMES>;
open (FILE_TO_ACT_ON, $file_to_act_on);
while (<FILE_TO_ACT_ON>) {
$name = $names[rand @names];
$lastname = $lastnames[rand @lastnames];
print $_, $name, $lastname;
}
------------------------------
Date: Tue, 08 Aug 2000 05:01:42 GMT
From: kcivey@cpcug.org (Keith Calvert Ivey)
Subject: Re: Impossible RegEx Problem
Message-Id: <39a19398.11324817@news.newsguy.com>
"Earthlink News" <rickysregistration@hotmail.com> wrote:
>Since the
>symbolic ref. is the easiest to type in (no messy curly brackets for my
>fingers to go searching for), that's the one I went with.
You might want to read Mark-Jason Dominus's three-part article
on symbolic references (it's not as long as it sounds):
http://www.plover.com/~mjd/perl/varvarname.html
--
Keith C. Ivey <kcivey@cpcug.org>
Washington, DC
------------------------------
Date: Tue, 08 Aug 2000 04:50:09 GMT
From: kcivey@cpcug.org (Keith Calvert Ivey)
Subject: Re: Interesection and subtraction of data sets.
Message-Id: <399e8fd6.10362573@news.newsguy.com>
Brian Lavender <blavender@spk.usace.army.mil> wrote:
>I playing around with manipulating sets of data, and I was happy I
>figured out how to find the interection between two sets, and how to
>subtract one set from the other. I looked through the Perl Cookbook, but
>I didn't find anything.
Is your copy missing page 106?
I don't understand why the Cookbook doesn't use hash slices in
that section, though.
--
Keith C. Ivey <kcivey@cpcug.org>
Washington, DC
------------------------------
Date: Tue, 08 Aug 2000 04:30:44 GMT
From: kcivey@cpcug.org (Keith Calvert Ivey)
Subject: Re: Mail::Mailer - multiple recipients?
Message-Id: <399b8b4a.9197997@news.newsguy.com>
nancy@bigfishmail.com wrote:
>$mailer->open({ From => $From,
> To => ['a@a.com','b@b.com','c@c.com'],
> Subject => $Subject});
>
>However, when I change the To line to:
> To => @To,
>if only sends the message to the first recipient listed.
You must have had an odd number of recipients; otherwise, you'd
have gotten a warning about an odd number of elements in a hash
(you *are* using -w and strict, right?). If you had, for
example,
@To = ('a@a.com','b@b.com','c@c.com');
then
$mailer->open({ From => $From,
To => @To,
Subject => $Subject});
is equivalent to
$mailer->open({ From => $From,
To => 'a@a.com',
'b@b.com' => 'c@c.com',
Subject => $Subject});
Hash values must be scalars, not arrays. You need an array
reference, as in your first example. Use \@To.
--
Keith C. Ivey <kcivey@cpcug.org>
Washington, DC
------------------------------
Date: Mon, 07 Aug 2000 22:20:15 -0700
From: Tim Conrow <tim@ipac.caltech.edu>
Subject: Re: Need explanation
Message-Id: <398F988F.8C9F9D50@ipac.caltech.edu>
> $data =~ s/'[^']*'//g;
perldoc perlre
Removes text which is surrounded by single quotes.
--
-- Tim Conrow tim@ipac.caltech.edu 626-395-8435
------------------------------
Date: 8 Aug 2000 06:57:20 GMT
From: vek@pharmnl.ohout.pharmapartners.nl (Villy Kruse)
Subject: Re: negative zero?
Message-Id: <slrn8ovbqf.260.vek@pharmnl.ohout.pharmapartners.nl>
On Fri, 04 Aug 2000 19:15:21 +0200,
Michael Sternberg <sternberg@phys.uni-paderborn.de> wrote:
>I found that some versions of perl treat zero-valued expressions as '-0'.
>This is strange to look at in scientific computing. How can I change the
>way this is handled?
>
>Consider this test program:
>
> @a = (0, -1, -0);
> for (@a) { $_ *= 0; }
> print -$x, "\t (@a) \t perl $]\t$^O\n";
>
>Here's the output for several platforms:
>
> 0 (0 -0 0) perl 5.004 hpux
> -0 (0 -0 0) perl 5.00404 solaris
> 0 (0 0 0) perl 5.00503 freebsd
> -0 (0 -0 0) perl 5.00503 linux
> -0 (0 -0 0) perl 5.006 dec_osf
>
>Note the different behaviour for the two 5.00503 versions.
>
After some testing it seems to happen any time a variable is
floting point type and converted to string.
compare:
my $a = 0; print -$a;
to
my $a = 0.0; print -$a;
or
my $a = 0; "$a"; print -$a;
It also appears that anytime you do arithmatic on a number it will
turn into a floating point number. Also, using a variable in string
context will make it float. Of course this might be very release
dependent.
The floating point on Intel 386 is signed magnitude format, which means
there are separate bit patterns for +0.0 and -0.0. The -0.0 value
would be represented by 0x8000000000000000.
In the 5.005 code there is a compile time swithc to do something about
that. if you search sv.c for the word NEGATIVEZERO or something similar
you will find it.
Villy
------------------------------
Date: Mon, 07 Aug 2000 22:11:00 -0700
From: Tim Conrow <tim@ipac.caltech.edu>
Subject: Re: Novice question: How to kill a process
Message-Id: <398F9664.B0699F88@ipac.caltech.edu>
satyapal_deja@my-deja.com wrote:
>
> Perl is new to me.
>
> I want the following shell statement to be executed from Perl.
>
> kill -HUP `ps -eaf | grep named | cut -c 11-15`
> (Baiscally I need to restart a named process)
perldoc -f kill
As for accessing the process table, I think there's a module that tries
to do it in a platform independant way, but I'm not sure. If portability
isn't a concern, start with
($ps) = grep(/named/,`ps -eaf`); # Only gets the first one
$pid = (split(" ",$ps))[1];
... or as one line ...
$pid = (split(" ",(grep(/named/,`ps -eaf`))[0]))[1];
... and season to taste. Me, I'd do more error checking along the way.
--
-- Tim Conrow tim@ipac.caltech.edu 626-395-8435
------------------------------
Date: Tue, 8 Aug 2000 03:57:06 GMT
From: "John P. Crisci" <jpcrisci@mailnwql.cr.usgs.gov>
Subject: perl program running with cgi extension
Message-Id: <398F8512.52C6AF93@mailnwql.cr.usgs.gov>
I have perl installed on a windows nt4.0. - using ActiveState. The cgi
program extension is associated with perl. The program works fine from
the command line and Internet Explorer. When I try to run it using
Netscape 4.x I get the pop-up window that asks if I want to save the
file to disk or run it from where it is at.
Does anyone know what settings Netscape might need to run this perl app?
TIA
John
------------------------------
Date: Mon, 7 Aug 2000 16:59:38 +0100
From: "Nick Gushlow" <nick.gushlow(@)usa.net>
Subject: Pop Ups
Message-Id: <398edd6a_2@nnrp1.news.uk.psi.net>
Help.
Can anybody tell me how to invoke alert windows?
Basically I have a form page, and if the user doesn't fill in required
information I want a little alert box to pop up and inform them so and send
them back to the page to fill out the details they missed.
--
Nick Gushlow
-------oOo-------
Email: nick.gushlow(@)usa.net
------------------------------
Date: Mon, 7 Aug 2000 17:08:34 +0100
From: "Nick Gushlow" <nick.gushlow(@)usa.net>
Subject: Pop Ups
Message-Id: <398edf5a_2@nnrp1.news.uk.psi.net>
Help.
Can anybody tell me how to invoke alert windows?
Basically I have a form page, and if the user doesn't fill in required
information I want a little alert box to pop up and inform them so and send
them back to the page to fill out the details they missed.
--
Nick Gushlow
-------oOo-------
Email: nick.gushlow(@)usa.net
------------------------------
Date: Tue, 08 Aug 2000 14:12:11 +0800
From: unplug <unplug@poboxes.com>
Subject: question
Message-Id: <398FA4BB.F56F6E78@poboxes.com>
Hi all,
If I have a string "abc efg 30 aaa bbb iii".
How can I retrieve only "30" from the above string??
Rgds,
unplug
------------------------------
Date: Tue, 08 Aug 2000 06:50:27 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: question
Message-Id: <slrn8ovbne.hoh.rgarciasuarez@rafael.kazibao.net>
unplug wrote in comp.lang.perl.misc:
>Hi all,
>
> If I have a string "abc efg 30 aaa bbb iii".
>How can I retrieve only "30" from the above string??
From which criteria? The 3rd space-separated field? All digits from the
string? The first field made up with digits? The last one? The first
field after "efg"? All characters except spaces and lower-case letters?
The length of the string plus eight?
--
Rafael Garcia-Suarez
------------------------------
Date: Tue, 08 Aug 2000 14:55:47 +0800
From: unplug <unplug@poboxes.com>
Subject: Re: question
Message-Id: <398FAEF3.8E05DE3@poboxes.com>
sorry for the unclear question.
below are what I want to do.
1. Retrieve all the digits from the string.
2. 3rd space-separated field.
unplug
Rafael Garcia-Suarez wrote:
>
> unplug wrote in comp.lang.perl.misc:
> >Hi all,
> >
> > If I have a string "abc efg 30 aaa bbb iii".
> >How can I retrieve only "30" from the above string??
>
> From which criteria? The 3rd space-separated field? All digits from the
> string? The first field made up with digits? The last one? The first
> field after "efg"? All characters except spaces and lower-case letters?
> The length of the string plus eight?
>
> --
> Rafael Garcia-Suarez
------------------------------
Date: Tue, 08 Aug 2000 04:22:57 GMT
From: kcivey@cpcug.org (Keith Calvert Ivey)
Subject: Re: reg expression query
Message-Id: <399a8976.8729815@news.newsguy.com>
Oszko & Malatinszky <soszko@gmu.edu> wrote:
>You would say
>
>$variable=~ s/$keyword/<b>$keyword<\/b>/gi;
>
>to make your substitution case-insensitive.
Yes, but if $keyword is 'Links', for example, then 'links' and
'LINKS' will get changed to 'Links' in the process. Something
like this might be better:
$variable =~ s/($keyword)/<b>$1<\/b>/gi;
A different delimiter would avoid leaning-toothpick syndrome
(having to backslash the slash):
$variable =~ s{($keyword)}{<b>$1</b>}gi;
And if the pattern in $keyword is supposed to be matched
literally but might contain metacharacters like '.' and '?',
use \Q and \E:
$variable =~ s{(\Q$keyword\E)}{<b>$1</b>}gi;
--
Keith C. Ivey <kcivey@cpcug.org>
Washington, DC
------------------------------
Date: Mon, 07 Aug 2000 22:30:40 -0700
From: Tim Conrow <tim@ipac.caltech.edu>
Subject: Re: reg expression query
Message-Id: <398F9B00.E0327A8E@ipac.caltech.edu>
Oszko & Malatinszky wrote:
>
> Troy Rasiah wrote:
>
> > Hi guys,
> > I have $variable which contains the following text
> > "events in Indonesia. Links to related sites LINKS links"
> >
> > I have $keyword="Links"
> >
> > $variable=~ s/$keyword/<b>$keyword<\/b>/g;
> >
> > Ok..that makes Links in variable bold when spat out in html. Is there a
> > simple way for me to be able to look for LINKS or links as well?
>
> ...
>
> $variable=~ s/$keyword/<b>$keyword<\/b>/gi;
>
> to make your substitution case-insensitive.
... or, to disallow "lInks", "LInks", "lInKs", etc., something like
$variable=~
s/$keyword|\U$keyword|\u$keyword|\L$keyword/<b>$keyword<\/b>/g;
To wit:
perl -wle '$key="Hello"; ($_ = "hello Hello HELLO hEllo HeLLo") =~
s/$key|\U$key|\u$key|\L$key/$key/g; print'
Hello Hello Hello hEllo HeLLo
--
-- Tim Conrow tim@ipac.caltech.edu 626-395-8435
------------------------------
Date: Tue, 08 Aug 2000 04:04:11 GMT
From: kcivey@cpcug.org (Keith Calvert Ivey)
Subject: Re: Regular Expressions & Substitution
Message-Id: <399885f8.7835823@news.newsguy.com>
"Tom Ford" <fordt@uci.edu> wrote:
>Can you use those in the actual regular expression? I thought within the
>regex you used the \1, \2 version, and afterwords the $1, $2, or does that
>only apply to the LHS?
Within the regex you use \1, \2, etc., but the last part of a
substitution isn't a regex. Only the first part is. Read the
warning in perlre.
--
Keith C. Ivey <kcivey@cpcug.org>
Washington, DC
------------------------------
Date: Tue, 08 Aug 2000 00:45:39 -0400
From: Albert Dewey <timewarp@shentel.net>
Subject: Re: Sendmail delivery failures
Message-Id: <398F9073.4F5E1B43@shentel.net>
Robert
I don't have an answer for you but I can steer you in the direction that
I am playing with to resolve the same situation. I have a submission
form where people can subscribe to certain info and I am storing their
email addresses in a data file. Obviously I want to weed out the bad
email addresses for this. I do send a confirm notice to the sender but I
do not want them to have to reply to this notice for certain reasons so,
like you, I want to capture the bounce messages and use them to remove
the offending email addresses that the users have entered into my
system. The approach I am looking into is to mimic the autoresponder
script that is provided by default on my server and to make my own
version of it that won't actually autorespond but instead go to the data
file where the email address are stored and delete them automatically. I
think that this is an easy and painless solution to this situation as I
don't have to reinvent the wheel. All I have to do now is to play with
this concept a bit and see if it works. Might work for you too.
Al
Robert wrote:
> Hello,
>
> I am using a Perl "Mailing List" script for sending emails to a
> list of addresses. The script uses sendmail to send out to all
> the addresses, but is there a way of logging which emails in the
> list are invalid? In other words, can Perl, or sendmail, capture
> mail delivery failure notifications in any way?
>
> If a mailing list becomes particularly large, I want to find out
> which addresses in the list are invalid without mailing each
> person individually.
>
> Thanks for any help you can offer,
>
> Rob.
>
> -----------------------------------------------------------
>
> Got questions? Get answers over the phone at Keen.com.
> Up to 100 minutes free!
> http://www.keen.com
------------------------------
Date: Tue, 08 Aug 2000 05:33:32 GMT
From: "Kenny Lim" <kennylim@techie.net>
Subject: Re: Simple reg expression question
Message-Id: <MYMj5.27749$Z6.773087@newsread1.prod.itd.earthlink.net>
"Kenny Lim" <kennylim@techie.net> wrote in message news:...
>
> Hi Rafael,
>
> Thanks for the great pointers ! Your solution works just fine.
>
> I am just wondering if it's possible that we choose to "either"
> increment only the major or the minor point version.
>
> ie.
>
> ETThread226
>
> Major = 2 (ie. increment to 3)
>
> or
>
> Minor = 26 (ie. increment to 27)
>
>
> What I am trying to achieve is to provide the flexibily to upgrade the
> version based
> on the release type. (major or minor release)
>
> You have a pleasant evening Rafael.
>
> Kenny-
>
>
>
> "Rafael Garcia-Suarez" <rgarciasuarez@free.fr> wrote in message
> news:slrn8oiadh.3oh.rgarciasuarez@rafael.kazibao.net...
> > Kenny Lim wrote in comp.lang.perl.misc:
> > >
> > >Hi All,
> > >
> > >Given the followng project name and version, how do I get the current
> > >version and increment by one ? It would be nice to also keep track
> > >of the number increment, ie. from 99 to 100 instead of going back to 0.
> ie.
> > >90.
> > >
> > >ETThread226
> > >ETDB2UI52
> >
> > If I correcly understood your question:
> >
> > $project_name =~ s/(\d+)$/1+$1/e;
> >
> > See perlop, perlre.
> >
> > --
> > Rafael Garcia-Suarez
>
>
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V9 Issue 3945
**************************************