[10466] in Perl-Users-Digest
Perl-Users Digest, Issue: 4058 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Oct 23 20:04:33 1998
Date: Fri, 23 Oct 98 17:01:33 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Fri, 23 Oct 1998 Volume: 8 Number: 4058
Today's topics:
Re: Perl & Y2K - booby trap code (Richard S. Holmes)
Re: Perl & Y2K - booby trap code (Larry Rosler)
Re: Perl & Y2K - booby trap code <zenin@bawdycaste.org>
perl5.005 on Linux has dld-problems ? <phade@powerweb.de>
Re: Printing large integers readably (malgosia askanas)
Re: Printing large integers readably (Larry Rosler)
Re: reference to array <r28629@email.sps.mot.com>
splitting on . <msholund@wans.net>
Re: splitting on . (Danny Groppo)
Re: splitting on . (Tad McClellan)
Re: splitting on . <r28629@email.sps.mot.com>
Re: Storing path info for access by many scripts (Danny Groppo)
UNIX or perl question? <sdrummon@mipos3.intel.com>
Win32::Perflib examples <alext@cri-boi.nospam.com>
Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 23 Oct 1998 17:27:09 -0400
From: rsholmes@rodan.syr.edu (Richard S. Holmes)
Subject: Re: Perl & Y2K - booby trap code
Message-Id: <xzcbtn3nf4i.fsf@rodan.syr.edu>
In article <u90i7jjdp.fsf@jimbosntserver.soundimages.co.uk> Jim Brewer <jimbo@soundimages.co.uk> writes:
>rsholmes@rodan.syr.edu (Richard S. Holmes) writes:
>
>>
>> TFM was part of the problem, not the solution.
>>
>
>Sorry, you are wrong. The documentation provided with Perl 5.004 is
>very clear about the state of time.
And had I had the documentation provided with Perl 5.004 in 1993, or
whenever it was I started using Perl, I would have been much better
off, wouldn't I?
Which was precisely the point I was trying to make. I'm sorry if you
misinterpreted me.
--
- Rich Holmes
Syracuse, NY / We have more important things to do...
Newport News, VA Censure and move on! Sign the petition at
rsholmes@mailbox.syr.edu <http://www.moveon.org>
------------------------------
Date: Fri, 23 Oct 1998 14:29:38 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Perl & Y2K - booby trap code
Message-Id: <MPG.109a951cc238f130989838@nntp.hpl.hp.com>
[Posted to comp.lang.perl.misc and a copy mailed.]
In article <70qqem$auj$1@monet.op.net> on 23 Oct 1998 16:54:46 -0400,
Mark-Jason Dominus <mjd@op.net> says...
>
> In article <70qmi7$45t@fohnix.metronet.com>,
> Tye McQueen <tye@fohnix.metronet.com> wrote:
> >And the month should be between 1 and 12 as well.
>
> Yeah, the month was a mistake too.
>
> It would have been really easy for people to define their month name
> arrays with an extra dummy element 0 on the front:
>
> @month =qw(Bad Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec);
>
> Certainly it would have been a lot easier than explaining to everyone
> why it emits `7' in August.
>
> Whoever designed the struct tm library really made a botch of it.
> If they had been either fifty percent cleverer or fifty percent less
> clever, it would have been a lot better than it is now.
Or they might have designed it now -- when my laptop PC has 96M of RAM -
- instead of then -- when everything had to be crammed into a few dozen
*K* on a PDP-11. The overhead of an extra item in an array or the code
to subtract one from the index would be considered significant.
The Unix philosophy of "Small is Beautiful" derives from this cramped
environment, which is so alien to us now. As one example, the Unix
'sort' command used to start spilling onto merge files at 32K of memory,
because that was much faster than thrashing the virtual memory. Now we
are doing in-memory sorts in Perl using 32M without a second thought.
Unless they have been improved by "fifty percent cleverer" people since
then, many commands still use algorithms designed for constrained
memory, and are linked by pipes (in other words, by I/O), when they
could be done "a lot better" in vast memories. And Perl (which
according to Ilya Z. is a humongous memory hog) would not have been
conceivable then.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 23 Oct 1998 23:51:48 GMT
From: Zenin <zenin@bawdycaste.org>
Subject: Re: Perl & Y2K - booby trap code
Message-Id: <909186476.368154@thrush.omix.com>
Mark-Jason Dominus <mjd@op.net> wrote:
: In article <70qmi7$45t@fohnix.metronet.com>,
: Tye McQueen <tye@fohnix.metronet.com> wrote:
: >And the month should be between 1 and 12 as well.
:
: Yeah, the month was a mistake too.
IYHO, of course.
: It would have been really easy for people to define their month name
: arrays with an extra dummy element 0 on the front:
:
: @month =qw(Bad Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec);
print "The months of the year are:\n";
foreach my $month (@months) {
print "$month\n";
}
Woops... If you're into this kind of pain, you might as well play
with $[ as it will lesson the throbbing a bit. :-)
--
-Zenin (zenin@archive.rhps.org) From The Blue Camel we learn:
BSD: A psychoactive drug, popular in the 80s, probably developed at UC
Berkeley or thereabouts. Similar in many ways to the prescription-only
medication called "System V", but infinitely more useful. (Or, at least,
more fun.) The full chemical name is "Berkeley Standard Distribution".
------------------------------
Date: Sat, 24 Oct 1998 00:14:11 +0000
From: Frank Gadegast <phade@powerweb.de>
Subject: perl5.005 on Linux has dld-problems ?
Message-Id: <363129E3.5636D0F5@powerweb.de>
Help,
does anybody knows how to compile the new perl
with dld on Linux ?
Which dld do I need ? Used gnu dld 3.3 ...
But no module loads, make test fails ...
perl-5.004 works fine.
Please replay by email.
Kind regards, Frank
--
Dipl.-Inform. Frank Gadegast mailto:frank@gadegast.de
PHADE Software - PowerWeb http://www.powerweb.de
Leibnizstr. 30, 10625 Berlin, Germany fon/fax: ++ 49 30 3128103
======================================================================
PowerWeb is WebPresenceProvider MPEG-1 Archive www.mpeg1.de
and hosts and sponsors ... KINOWEB www.kinoweb.de
------------------------------
Date: 23 Oct 1998 17:12:13 -0400
From: ma@panix.com (malgosia askanas)
Subject: Re: Printing large integers readably
Message-Id: <70qrfd$9mm@panix2.panix.com>
Ah, Jim Allenspach pointed out that this is covered in the FAQ.
Yes yes yes. Beautiful. Many thanks.
-malgosia
------------------------------
Date: Fri, 23 Oct 1998 14:32:34 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Printing large integers readably
Message-Id: <MPG.109a95cda673209c989839@nntp.hpl.hp.com>
[Posted to comp.lang.perl.misc and a copy mailed.]
In article <70qqat$8f1@panix2.panix.com> on 23 Oct 1998 16:52:45 -0400,
malgosia askanas <ma@panix.com> says...
> What is the simplest way of getting Perl to print out large integers
> with commas between every group of 3 digits (e.g. "1,356,400")?
By far the simplest way is to read the FAQ, searching for 'comma'.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Fri, 23 Oct 1998 18:01:25 -0500
From: Tk Soh <r28629@email.sps.mot.com>
Subject: Re: reference to array
Message-Id: <36310AC5.A45CE9B2@email.sps.mot.com>
Uri Guttman wrote:
> UG> you can index from the end of any array (anon or real) with
> UG> negative numbers. so the last element is @array[-1]. i leave it as
> UG> an very easy exercise to make that work for an anon array.
>
> me brain dead. it is friday. the phase of the moon bothering me. it
> should be $array[-1]. somedays i just can't type what i mean.
>
but @array[-1] still works, in this case:
DB<31> @a = (1,2,3,4,5)
DB<32> $s = @a[-1]
DB<33> x $s
0 5
DB<34> $s = $a[-1]
DB<35> x $s
0 5
-tk
------------------------------
Date: Fri, 23 Oct 1998 17:47:49 -0400
From: Mark Sholund <msholund@wans.net>
Subject: splitting on .
Message-Id: <3630F985.1A196D8@wans.net>
I have been trying to split a string into parts that are delimited by
periods. I started by trying split(/./,$IP), but since "." matches
everything, split has no effect.
I have found a way around this by split(/\W/,$IP) (split by
non-alphanumic characters), but what if I wanted to split time such as
"12:00:00.000543" into "12:00:00" and "000543"? Splitting by
non-alphanumerics will split it into four parts, not two.
--
in accordance with prophecy.
"The price of freedom is eternal vigilance."
- Admiral Tolwyn (Wing Commander IV)
------------------------------
Date: Fri, 23 Oct 1998 22:36:00 GMT
From: gosdpads@yahoo.com (Danny Groppo)
Subject: Re: splitting on .
Message-Id: <363103d6.797637251@nntp.cts.com>
On Fri, 23 Oct 1998 17:47:49 -0400, Mark Sholund <msholund@wans.net>
wrote:
>I have been trying to split a string into parts that are delimited by
>periods. I started by trying split(/./,$IP), but since "." matches
>everything, split has no effect.
>
>I have found a way around this by split(/\W/,$IP) (split by
>non-alphanumic characters), but what if I wanted to split time such as
>"12:00:00.000543" into "12:00:00" and "000543"? Splitting by
>non-alphanumerics will split it into four parts, not two.
>--
>in accordance with prophecy.
>
> "The price of freedom is eternal vigilance."
> - Admiral Tolwyn (Wing Commander IV)
split(/\./, $IP);
or
split(/[.]/, $IP);
Danny Groppo
gosdpads@yahoo.com
------------------------------
Date: Fri, 23 Oct 1998 18:01:51 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: splitting on .
Message-Id: <vs1r07.pqv.ln@flash.net>
Mark Sholund (msholund@wans.net) wrote:
: I have been trying to split a string into parts that are delimited by
: periods. I started by trying split(/./,$IP), but since "." matches
: everything, split has no effect.
It is a common convention in Unix, carried over to Perl, that
if you want a metacharacter (dot is one of those here) to not
be "meta" (ie. you want it literally), you precede it with
a backslash character:
split(/\./,$IP);
Or, you could put it into a Character Class, since dot is not
meta in a char class:
split(/[.]/,$IP);
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Fri, 23 Oct 1998 18:04:38 -0500
From: Tk Soh <r28629@email.sps.mot.com>
Subject: Re: splitting on .
Message-Id: <36310B86.61532D53@email.sps.mot.com>
Mark Sholund wrote:
>
> I have been trying to split a string into parts that are delimited by
> periods. I started by trying split(/./,$IP), but since "." matches
> everything, split has no effect.
>
> I have found a way around this by split(/\W/,$IP) (split by
> non-alphanumic characters), but what if I wanted to split time such as
> "12:00:00.000543" into "12:00:00" and "000543"? Splitting by
> non-alphanumerics will split it into four parts, not two.
split(/\./,$IP)
-tk
------------------------------
Date: Fri, 23 Oct 1998 22:28:15 GMT
From: gosdpads@yahoo.com (Danny Groppo)
Subject: Re: Storing path info for access by many scripts
Message-Id: <3631028d.797308949@nntp.cts.com>
On Fri, 23 Oct 1998 13:39:56 -0700, Sean Scannell
<sean@select-systems.com> wrote:
>Ok, I've missed a basic step somehow. To access a few strings like
>
>$home_dir = '/my_app/';
>$read_dir = '/my_app/read/';
>$mailprog = '/usr/lib/sendmail/';
>
>from many scripts, I created a file Env_var.pm that contains
>
>package Env_var;
>$home_dir = '/my_app/';
>$read_dir = '/my_app/read/';
>$mailprog = '/usr/lib/sendmail/';
>
>In my script I write
>
>use Env_var;
>print $home_dir;
>
>Nothing prints. Do I need to install the module using Makemaker, or is
>there an easier way?
>
print Env_var::$home_dir;
or leave off the "package Env_var;" in Env_var.pm and then:
require Env_var;
Danny Groppo
gosdpads@yahoo.com
------------------------------
Date: Fri, 23 Oct 1998 16:11:49 -0700
From: "Scott B. Drummonds" <sdrummon@mipos3.intel.com>
Subject: UNIX or perl question?
Message-Id: <36310D35.7DE1@mipos3.intel.com>
Greetings, all. I'm doing the following in perl, even though I think
that might be a UNIX, or even Win98, question. The script I'm talking
about is being run from a Win98 system using an ISP to the net.
I'm trying create a local socket so I can connect to a remote system.
Creating the socket, binding, and connecting are all working. However,
that process is indirectly dependent on gethostbyname().
Now, if I find out my internet name (which, incidentally, since I'm
using an ISP and connecting via modem, it changes every connection) all
of the above works fine. However, unlike UNIX,
gethostbyname("localhost") doesn't seem work.
So, what perl and/or C function will allow me to retrieve this name in
the perl script so I don't have to edit some scalar variable setting
every time I run the script? Is there a getlocalhost() function or
something that would do what that name suggests?
Thanks in advance,
Scott
--
Scott Brady Drummonds | Phone: (408)765-8093 | I got soul,
sdrummon@mipos3.intel.com | Location: SC9-2C7 | I'm super-bad.
If I just said something about Intel, I was just kidding.
------------------------------
Date: Fri, 23 Oct 1998 15:04:50 -0600
From: Alex Tatistcheff <alext@cri-boi.nospam.com>
Subject: Win32::Perflib examples
Message-Id: <3630EF72.93BF0655@cri-boi.nospam.com>
I'm getting this module figured out but unfortunately my script still
has some bugs in it because although the data looks good - it's wrong.
The performance counter does not seem to be accessing the perf data on
the NT server like it should. I'm wondering if anyone has any example
scripts or knows of any using Win32::PerfLib?
--
Alex Tatistcheff
CRI/The Resource Group, Inc.
Boise, ID
Please remove "nospam" from my email when replying
------------------------------
Date: 12 Jul 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Mar 98)
Message-Id: <null>
Administrivia:
Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.
If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu.
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.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
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.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
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 V8 Issue 4058
**************************************