[13842] in Perl-Users-Digest
Perl-Users Digest, Issue: 1252 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Nov 2 09:06:04 1999
Date: Tue, 2 Nov 1999 06:05:15 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <941551514-v9-i1252@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Tue, 2 Nov 1999 Volume: 9 Number: 1252
Today's topics:
Re: <STDIN> to a @ (David Cantrell)
Re: a tree of subdirectories in perl? (Jaime)
Re: Another 'or'? was [perl double-split] (Bart Lateur)
Re: Another 'or'? was [perl double-split] (Anno Siegel)
Re: Another 'or'? was [perl double-split] (Abigail)
Re: Book suggestions <gellyfish@gellyfish.com>
Re: Book suggestions (A.J. Norman)
g++ - was Re: Perl disallowed at ACM programming contes <camerond@mail.uca.edu>
Help needed <moinsharif@yahoo.com>
help with simple registration CGI script muhudin@my-deja.com
Help!!! Need Net::Ping to work ASAP! <ralawrence@my-deja.com>
Re: I'm a bit lost with this LWP problem <gisle@aas.no>
More Than A Little Help Needed for a newbie.... <o.r.dickenson@student.salford.ac.uk>
PDK PerlCtrl vs Delphi 4 and 5 (Win32) <a2651866@smail.uni-koeln.de>
Re: Perl & Excel FitToPages Settings morgand@att.com
Re: perl double-split (Anno Siegel)
Re: perl JS interpreter? counting keywords? <gellyfish@gellyfish.com>
Re: Perl Newbie <ralawrence@my-deja.com>
Re: Premature End Of Script Headers <gellyfish@gellyfish.com>
Re: Range operators: two dots v.s. three dots <skilchen@swissonline.ch>
real time less than user time? (Dmitry Sazonov)
Re: real time less than user time? (Steve Bellenot)
Re: real time less than user time? (Casper H.S. Dik - Network Security Engineer)
Recursive Directory Search <garcia868@yahoo.com>
Re: Recursive Directory Search <jeffp@crusoe.net>
Sort order in Perl h.benne@library.uu.nl
Re: string number conversion (Abigail)
Re: string number conversion (Abigail)
Re: Stripping live HTML into text (Abigail)
Re: Stripping live HTML into text (Nick Kew)
Re: Stripping live HTML into text <flavell@mail.cern.ch>
undef()-fing multiple items at once (Bart Lateur)
Re: What makes the web go? (Mark W. Schumann)
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 02 Nov 1999 11:46:55 GMT
From: NukeEmUp@ThePentagon.com (David Cantrell)
Subject: Re: <STDIN> to a @
Message-Id: <3821cd6f.413360050@10.0.0.155>
On Sat, 30 Oct 1999 01:07:54 -0300, "morpheus" <r00tz@ciudad.com.ar>
said:
>I need to get 8 letters from the user and put each one of them in a
>different part of an array (
>@array[0] = m;
>@array[1] = d;
>...
>Anybody could help me?
print "Please type eight letters followed by the Enter key";
$letters=<STDIN>;
$letters=~y/[a-z]//cd;
@array=split(/.{0}/,$letters) if(length($letters)==8);
print join(',',@array) if(@array); # Just to prove it works
--
David Cantrell, part-time Unix/perl/SQL/java techie
full-time chef/musician/homebrewer
http://www.ThePentagon.com/NukeEmUp
------------------------------
Date: Tue, 02 Nov 1999 12:52:25 +0200
From: lsprilus@weizmann.weizmann.ac.il (Jaime)
Subject: Re: a tree of subdirectories in perl?
Message-Id: <lsprilus-0211991252250001@meg.weizmann.ac.il>
In article <x7zowx8ilx.fsf@home.sysarch.com>, Uri Guttman
<uri@sysarch.com> wrote:
>just a few comments:
>use my instead of local. this looks like perl4 code.
It is. Was coded on July 26 1996
I just sent a working code I have. This don't try to be an
example of perfect programming.
Use it if you need/like. Leave it if not :)
------------------------------
Date: Tue, 02 Nov 1999 11:47:34 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Another 'or'? was [perl double-split]
Message-Id: <381fcaa2.1379441@news.skynet.be>
lt lindley wrote:
>:>Fine with me. If you want to explain to your customer "do not try to use
>:>this script with a file named C<0>", well, it is your problem.
>
>If the customer actually complains that the program doesn't work with
>a file named '0', I tell them not to use a file with that name. :-)
It's not just that. It is very dangerous to assume certain things about
a text string, just because they happen to be true on most cases. In
particular: the boolean truth of a string. Very oftern, it is assumed
that "it has a value, therefore it is 'true'". Well: "0" is a value, but
it is NOT true.
In fact: Perl is a rather dangerous language in this regards, because it
makes it most easy to write rather buggy programs this way. The "||"
construct is the most explicit example: nothing is more easy than to
write:
$_ = $data{text} || $data{caption};
if some "object" (an item in a GUI) may have a "caption" property, or a
"text" property, and both are, in fact, equivalent. But if the "caption"
is the string "0", and the "text" doesn't exist, well, you get undef as
a result. Yuck. And wrong.
What will you do? Write:
$_ = defined($data{text})?$data{text}:$data{caption});
? Yeah, right. I believe that. Not.
Shortcutting is just too useful. So there really is a need for a
shortcut operator, that continues if and only if the left side is
undefined. Larry W. suggested "??", so for now it is the consensus that
that will be it.
--
Bart.
------------------------------
Date: 2 Nov 1999 12:58:49 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Another 'or'? was [perl double-split]
Message-Id: <7vmn69$aed$1@lublin.zrz.tu-berlin.de>
Ilya Zakharevich <ilya@math.ohio-state.edu> wrote in comp.lang.perl.misc:
>[A complimentary Cc of this posting was sent to lt lindley
><lee.lindley@bigfoot.com>],
>> I'll buy your argument about the
>> psychology of that. But once aware of the problem, I don't mind
>> adding the extra line of code (when I care enough to do it).
>
>This looks as it confirms my point. The "threshold of nuisance" being
>lowered almost to 0 would (may?) lead to a different "care enough"
>threshold.
Yet, the psychology cuts both ways. If psychology cuts at all, that is.
I mean, that leaves us with four or-like operators: "|", "||", "or",
and "??". How's a poor script kiddie to know when to use which? And
soon people will be clamoring for "???" or whatever to do for exist()ence
what "??" does for defined()ness. Where will it all end...
Well, I guess all that and more has been said on p5p before. Just
ignore me.
Anno
------------------------------
Date: 2 Nov 1999 07:41:46 -0600
From: abigail@delanet.com (Abigail)
Subject: Re: Another 'or'? was [perl double-split]
Message-Id: <slrn81tqfl.ren.abigail@alexandra.delanet.com>
Bart Lateur (bart.lateur@skynet.be) wrote on MMCCLIV September MCMXCIII
in <URL:news:381fcaa2.1379441@news.skynet.be>:
@@
@@ It's not just that. It is very dangerous to assume certain things about
@@ a text string, just because they happen to be true on most cases. In
@@ particular: the boolean truth of a string. Very oftern, it is assumed
@@ that "it has a value, therefore it is 'true'". Well: "0" is a value, but
@@ it is NOT true.
@@
@@ In fact: Perl is a rather dangerous language in this regards, because it
@@ makes it most easy to write rather buggy programs this way. The "||"
@@ construct is the most explicit example: nothing is more easy than to
@@ write:
@@
@@ $_ = $data{text} || $data{caption};
@@
@@ if some "object" (an item in a GUI) may have a "caption" property, or a
@@ "text" property, and both are, in fact, equivalent. But if the "caption"
@@ is the string "0", and the "text" doesn't exist, well, you get undef as
@@ a result. Yuck. And wrong.
Eh, no. You would get "0" back.
@@ What will you do? Write:
@@
@@ $_ = defined($data{text})?$data{text}:$data{caption});
@@
@@ ? Yeah, right. I believe that. Not.
@@
@@ Shortcutting is just too useful. So there really is a need for a
@@ shortcut operator, that continues if and only if the left side is
@@ undefined. Larry W. suggested "??", so for now it is the consensus that
@@ that will be it.
With Sarathy against, backed by some prominent p5p-ers, extremely unlikely
it will happen anytime soon - no matter how many people really want this.
I'd love to see it though.
Abigail
--
$_ = "\x3C\x3C\x45\x4F\x54"; s/<<EOT/<<EOT/e; print;
Just another Perl Hacker
EOT
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: 2 Nov 1999 11:45:51 GMT
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Book suggestions
Message-Id: <381eceef_2@newsread3.dircon.co.uk>
Abigail <abigail@delanet.com> wrote:
> Joel Berger (joel_berger@manulife.com) wrote on MMCCLIII September
> MCMXCIII in <URL:news:2mlT3.386$Ao3.125@198.235.216.4>:
> ,, Suggestions for a good book for a newbie?
>
>
> Winnie-the-Pooh.
>
Certainly 'The Tao Of Poo' - "code without thinking" ....
/J\
--
"As usual I'm the price you have to pay for the funny bits" - Denis Norden
------------------------------
Date: 2 Nov 1999 13:25:04 -0000
From: nja@le.ac.uk (A.J. Norman)
Subject: Re: Book suggestions
Message-Id: <7vmong$4ls22@harrier.le.ac.uk>
In article <MPG.1287a85df201ca5c98a173@nntp.hpl.hp.com>, Larry Rosler
<lr@hpl.hp.com> wrote:
> In article <381DF381.12F74439@mail.cor.epa.gov> on Mon, 01 Nov 1999
> 12:09:37 -0800, David Cassell <cassell@mail.cor.epa.gov> says...
>
>> If you are an experience programmer who hasn't used Perl before,
>> look at "Programming Perl" or "Perl in a Nutshell".
>
> For that kind of programmer, Nigel Chapman's book, "Perl: The
> Programmer's Companion", is likely to be a good introduction to
> Perl, perhaps better even than "Programming Perl". But each of them
> is a 'good read'.
I think given the "newbie" description Chapman's book is not the best
place to start, though I agree it's excellent as a book for
experienced programmers. There are some programming books I read
because I want to find out something (the Camel is one of those) and
some I read because I enjoy them - Srinivasan's "Advanced Perl
Programming", Kernighan and Pike's "The Practice of Programming" and
Chapman's book being examples. They work as intellectual
entertainment not just as "how to" guides or reference works. I'm not
sure even as an experienced programmer I'd want to try learning Perl
from Chapman, I'd go for "Learning Perl" first and then turn to
Chapman or Srinivasan for the huge amount of stuff not covered in LP.
--
Andrew Norman, Leicester, England
nja@le.ac.uk || andrew.norman@le.ac.uk
http://www.le.ac.uk/engineering/nja/
------------------------------
Date: Tue, 02 Nov 1999 07:57:24 -0600
From: Cameron Dorey <camerond@mail.uca.edu>
To: "Mark W. Schumann" <catfood@apk.net>
Subject: g++ - was Re: Perl disallowed at ACM programming contests?
Message-Id: <381EEDC4.CB8AD7A4@mail.uca.edu>
"Mark W. Schumann" wrote:
[cc'd to mws]
>
> In article <6y7lk2ed01.fsf@anu.edu.au>,
> Tim Potter <Tim.Potter@anu.edu.au> wrote:
> >bart.lateur@skynet.be (Bart Lateur) writes:
> >> Mark W. Schumann wrote:
> >>
> >> >This is just killing me. ACM is now handing out Visual C++ as a
> >> >"prize"?
>
> I suppose it would be weird to give away a copy of g++.
>
I haven't heard of g++, although I use G in my work, along with Perl.
Has M$ sucked this one up, too? :(
Cameron
--
Cameron Dorey
Associate Professor of Chemistry
University of Central Arkansas
Phone: 501-450-5938
camerond@mail.uca.edu
------------------------------
Date: Tue, 02 Nov 1999 10:57:15 GMT
From: Moin <moinsharif@yahoo.com>
To: moinsharif@my-deja.com
Subject: Help needed
Message-Id: <7vmg2c$mf4$1@nnrp1.deja.com>
I am using mysql and perl on a linux server. I have a problem with mysql
query.
I am doing a project which involves capturing time for a particular
event,
example
Event : Time_From Time_TO
event1 3:00 5:00
event3 5:00 6:00
now if the user wants to enter event2 between 3:30 to 4:30 the program
should restrict him to enter into the database, because there is a event
already between 3:00 to 5:00, the Data type I am using for Time_From
and Time_To is "Time". Can anyone please let me know the query in mysql
to achieve this, or a way to do this in perl. Inperl I have tied to do
this but when I am trying to compare the if 3.00 < 3.30 if does not
check properly.
Can any one help me.
Thank you,
Moin
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Tue, 02 Nov 1999 13:35:53 GMT
From: muhudin@my-deja.com
Subject: help with simple registration CGI script
Message-Id: <7vmpbp$sqp$1@nnrp1.deja.com>
Hi all perlers:-)
My teacher gave me an assignment. And I really need help. Please help. I
want a simple CGI registration script
It should have one text field for name, one for email, one for password
and one more for re-enter password. Also the SQL commands that save that
information in Oracle database. Information on all registered members
are kept in Oracle database NOT in Unix file.
Thanks in advance
muhudin-
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Tue, 02 Nov 1999 11:34:42 GMT
From: Richard Lawrence <ralawrence@my-deja.com>
Subject: Help!!! Need Net::Ping to work ASAP!
Message-Id: <7vmi8i$ntp$1@nnrp1.deja.com>
Hi all,
I've got a bit of a strange problem with Net::Ping. Basically it
doesn't work. Here is the code spooned straight out of the man page:
#!/usr/bin/perl
use Net::Ping;
# I added the next line
my $host = "rhubarb.custard.org";
$p = Net::Ping->new();
print "$host is alive.\n" if $p->ping($host);
$p->close();
I run this and get the following error:
Bad arg length for Socket::unpack_sockaddr_in, length is 0, should be
16 at /usr/lib/perl5/5.00503/i386-linux/Socket.pm line 295.
What on earth is going on? Have I done something wrong? I tried
changing it to the IP address but that didn't work either. I tried
"localhost" and "127.0.0.1" and all of them produce the same error.
Can anyone help please?
Rich
Any suggestions gre
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 02 Nov 1999 12:36:41 +0100
From: Gisle Aas <gisle@aas.no>
Subject: Re: I'm a bit lost with this LWP problem
Message-Id: <m3k8o16s6u.fsf@eik.g.aas.no>
Tom Phoenix <rootbeer@redcat.com> writes:
> On Thu, 28 Oct 1999, Bill Moseley wrote:
>
> > I'm passing it www.test.com:44991/test and I get the error:
> > Can't locate URI/www_Otest_Ocom.pm in @INC (@INC contains: /home/....)
> > at (eval 21) line 3.
> >
> > What are those "_0" doing there?
>
> I don't see any "_0", but I see "_O". I wonder whether the error message
> might have included some control characters which caused something weird
> on your monitor.
A URI like "www.test.com:44991/test" parsed such that "www.test.com"
end up as the scheme part. Then the URI module will then encode "."
as "_O" in order to get a valid perl identifier and then try to load
the module "URI/www_Otest_Ocom.pm" to see if it has something to say.
When this does not work URI should just silently assume generic URI
syntax. You should not see the message above at all. Perhaps there
is some evil $SIG{__DIE__} handler playing some tricks here?
I don't think there was any good reason for why "_O" was chosen as the
translation for ".".
If you want to use shorthand URIs like the one above then you need to
use the URI::Heuristic module.
--
Gisle Aas
------------------------------
Date: Tue, 02 Nov 1999 13:31:51 +0000
From: Owen Dickenson <o.r.dickenson@student.salford.ac.uk>
Subject: More Than A Little Help Needed for a newbie....
Message-Id: <381EE7C4.265DE695@student.salford.ac.uk>
Hi all, this is my first post to this newsgroup so i'll give u all a
little background to my problem and myself. i am 19 years old and
currently studing for a BSc in Information Technology at Slaford
university (www.salford.ac.uk)
As part of the degree we gave to undertake a Multi Year team project for
a real client. ours is a local college. They have a wind turbine and
they want a live data feed to a website which produes graphs and
compares the figures to historical data. there web server is on UNIX
and thier network is NT4. basicaly the problem is that we have no idea
how to do this, several people i know have suggested perl but i don't
know anything about it. ideally what i need is to be pointed in the
direction of some resources that will be useful and maybe even a few
good guide site's to perl. since i don't really know what need to know
*boggles* then i can't really be more specific. feel free to email me
at O.R.Dickenson@student.salford.ac.uk with any information you think i
may find useful. i will also check this newsgroup for anything.
Thanks for your help,
Owen Dickenson.
------------------------------
Date: 02 Nov 1999 14:44:40 +0100
From: Lash Canino <a2651866@smail.uni-koeln.de>
Subject: PDK PerlCtrl vs Delphi 4 and 5 (Win32)
Message-Id: <qd7ttxb1z.fsf@fairy.fairground>
When trying to import the ActiveX controls HelloCtrl.dll and
Re.dll of the Perl Development Kit (PDK) 1.2 from the Delphi 4
(Update Pack 2) and 5 IDE, nothing happens; in particular,
the controls do not show up in the list of ActiveX servers
registered with Windows NT. Regsvr32 succeeds on both of them,
so that registry keys and values are created. But Delphi does
not notice. Why? How to use PerlCOM instead?
------------------------------
Date: Tue, 02 Nov 1999 11:41:38 GMT
From: morgand@att.com
Subject: Re: Perl & Excel FitToPages Settings
Message-Id: <7vmili$o1l$1@nnrp1.deja.com>
Jan,
Thanks for your help! This did the trick for me. I appreciate your
taking the time to respond in detail.
Thanks again,
Dale Morgan
morgand@att.com
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 2 Nov 1999 12:12:12 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: perl double-split
Message-Id: <7vmkes$acv$1@lublin.zrz.tu-berlin.de>
lt lindley <lee.lindley@viasystems.com> wrote in comp.lang.perl.misc:
>Kenneth Bandes <kbandes@home.com> wrote:
>:>Ilya Zakharevich wrote:
>:>> my $values = <> ?? die "'Name' line without matched 'values' line.\n";
>:>>
>:>> is the proper solution.
>
>:>Is ?? in the language? I've got 5.005 patch 61 and it isn't documented
>:>(except in perltodo as "or" testing defined not truth, which I assume
>:>is what you mean) that I can find.
>
><Groan>
>Once that operator exists people will never stop harping on
>looking out for the case where <> returns the string 0 without
>a newline; a condition that has about as much chance of happening
>in any reasonable dataset as I do of winning the lottery.
></Groan>
But, but... the ?? operator would really do its thing to make people
*stop* harping about that condition. "??" would let you use '0' as a
valid line, while "or" would skip it.
Btw, the last line not being followed by "\n" is standard in MacOS
(and probably others), where "\n" is a line separator, not terminator.
I believe that perl IO supplies the missing final "\n", but a file
sloppily transferred from MacOS to Unix could easily come without it.
Good luck with the lottery.
Anno
------------------------------
Date: 2 Nov 1999 13:48:58 GMT
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: perl JS interpreter? counting keywords?
Message-Id: <381eebca_1@newsread3.dircon.co.uk>
Laurent Itti <itti@klab.caltech.edu> wrote:
>
> But javascript interpretation is the one thing which looks absolutely
> necessary and which I have not found so far (unix environment, linux).
> Any advice would be greatly appreciated!
>
Of course this is nothing at all to do with Perl. You might look at
<http://www.mozilla.org/js> however.
/J\
--
"Tony Blair is reported to be detained indefinitely under plans unveiled
by the Home Secretary" - Corrupt Teletext Page
------------------------------
Date: Tue, 02 Nov 1999 12:15:26 GMT
From: Richard Lawrence <ralawrence@my-deja.com>
Subject: Re: Perl Newbie
Message-Id: <7vmkks$pg6$1@nnrp1.deja.com>
In article <381ec0f1@isoit370.bbn.hp.com>,
"Andrew Longworth" <Andrew_Longworth@bigfoot.com> wrote:
> I have never used perl before and need to write some perl. Does
anyone know
> where I can find info on the web. (tutorials etc.)
>
www.perl.com is as good a start as any. It has links to a whole
selection of tutorials and stuff.
Personally I'd recommend buying a book. The O'Reilly ones are damn good
and written by people who actually know what they are talking about.
HTH
Rich.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 2 Nov 1999 13:34:26 GMT
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Premature End Of Script Headers
Message-Id: <381ee862_1@newsread3.dircon.co.uk>
Martin Elliott <martin@mert.globalnet.co.uk> wrote:
> When I run my Perl CGI on server, having tested it with Perl Builder
> off-line, I get a 'Premature End Of Script Header' error in the error log.
>
> Does anyone know what this means and how to fix it as I am still learning
> Perl and trying to get to grips with it?
>
The first section of perlfaq9 deals with this explicitly
>
> p.s. sorry for the cgi content, but I can't approve any messages to
> comp.infosystems...cgi.
>
Hmmph.
/J\
--
"The teenage masturbators of today are the television executives of
tomorrow" - Melissa Cabriolet, Drop the Dead Donkey
------------------------------
Date: Tue, 02 Nov 1999 11:35:52 GMT
From: "Samuel Kilchenmann" <skilchen@swissonline.ch>
Subject: Re: Range operators: two dots v.s. three dots
Message-Id: <s0AT3.28199$m4.101414693@news.magma.ca>
Abigail <abigail@delanet.com> wrote in message
news:slrn81t8om.66b.abigail@alexandra.delanet.com...
> John Lin (johnlin@chttl.com.tw) wrote on MMCCLIV September MCMXCIII
in
> <URL:news:7vlnis$j0c@netnews.hinet.net>:
> ~~ Hi,
> ~~ I see the two dot operator '..' and three dot operator '...'
in perlop.
> ~~ Without examples, I can't understand the difference.
>
>
> $ perl -wle 'for (qw /foobar barbar bazbar/) {print}' |\
> perl -wne 'print if /foo/ .. /bar/'
> foobar
> barbar
> $ perl -wle 'for (qw /foobar barbar bazbar/) {print}' |\
> perl -wne 'print if /foo/ ... /bar/'
> foobar
> $
>
You must have a broken Perl...
------------------------------
Date: Tue, 2 Nov 1999 13:07:19 GMT
From: dima@racoon.riga.lv (Dmitry Sazonov)
Subject: real time less than user time?
Message-Id: <FKKn48.181@racoon.riga.lv>
Hello,
Why is it real time of a linear perl script could be less then user time.
Yes, it's dual processor, so what?
Any theories?
Thanks,
w@sunhost:~>time ./somescript.pl
real 2m43.108s
user 3m20.620s
sys 0m9.700s
w@sunhost:~>uname -a
SunOS sunhost 5.7 Generic_106541-05 sun4u sparc SUNW,Ultra-Enterprise
------------------------------
Date: 2 Nov 1999 13:15:50 GMT
From: bellenot@math.fsu.edu (Steve Bellenot)
Subject: Re: real time less than user time?
Message-Id: <7vmo66$35h$1@news.fsu.edu>
In article <FKKn48.181@racoon.riga.lv>,
Dmitry Sazonov <dima@racoon.riga.lv> wrote:
>Hello,
>
>
>Why is it real time of a linear perl script could be less then user time.
>Yes, it's dual processor, so what?
>Any theories?
A perfectly parallel program that needs 4 seconds of compute time
on a single processor can divide the time equally on two processors
so the wall clock shows only 2 seconds of "real time", but you
have still used 2 seconds cpu time on processor 0 + 2 seconds of
cpu time on processor 1 for 4 seconds of CPU or user+system time.
>
>Thanks,
>
>w@sunhost:~>time ./somescript.pl
>
>real 2m43.108s
>user 3m20.620s
>sys 0m9.700s
>w@sunhost:~>uname -a
>SunOS sunhost 5.7 Generic_106541-05 sun4u sparc SUNW,Ultra-Enterprise
>
--
bellenot@math.fsu.edu http://www.math.fsu.edu/~bellenot (850)644-7189 (4053fax)
------------------------------
Date: 2 Nov 1999 13:54:45 GMT
From: Casper.Dik@Holland.Sun.Com (Casper H.S. Dik - Network Security Engineer)
Subject: Re: real time less than user time?
Message-Id: <7vmqf5$e4u$1@new-usenet.uk.sun.com>
[[ PLEASE DON'T SEND ME EMAIL COPIES OF POSTINGS ]]
dima@racoon.riga.lv (Dmitry Sazonov) writes:
>Why is it real time of a linear perl script could be less then user time.
>Yes, it's dual processor, so what?
>Any theories?
Does it fork? Using threaded perl?
Casper
--
Expressed in this posting are my opinions. They are in no way related
to opinions held by my employer, Sun Microsystems.
Statements on Sun products included here are not gospel and may
be fiction rather than truth.
------------------------------
Date: Tue, 2 Nov 1999 05:53:11 -0800 (PST)
From: J Garcia <garcia868@yahoo.com>
Subject: Recursive Directory Search
Message-Id: <19991102135311.14612.rocketmail@web1605.mail.yahoo.com>
I have written a small Perl program to search (regexp
matching) all files (of user-supplied extension) in
the current directory for a specific word after
getting a list of all files using glob().
I would like to know if it there is any function or
some possible way that would allow me to recursively
search (pattern matching) all files and directorires
in the current directory.
The may be some function to do this in Unix, but I am
using Windows and ActivePerl. Thanks for any help.
=====
__________________________________________________
Do You Yahoo!?
Bid and sell for free at http://auctions.yahoo.com
------------------------------
Date: Tue, 2 Nov 1999 08:57:11 -0500
From: Jeff Pinyan <jeffp@crusoe.net>
Subject: Re: Recursive Directory Search
Message-Id: <Pine.GSO.4.10.9911020855370.4217-100000@crusoe.crusoe.net>
[posted & mailed]
On Nov 2, J Garcia blah blah blah:
> I would like to know if it there is any function or
> some possible way that would allow me to recursively
> search (pattern matching) all files and directorires
> in the current directory.
You want the File::Find module. You might already have it.
perldoc File::Find
> The may be some function to do this in Unix, but I am
> using Windows and ActivePerl. Thanks for any help.
Sigh. Many people think ActivePerl and Perl are really different. Ok, so
flock() doesn't work, and alarm() doesn't work. But a great deal of the
core functionality is there. Recursing through subdirectories can be done
on any system.
--
MIDN 4/C PINYAN, USNR, NROTCURPI
jeff pinyan japhy@pobox.com
perl stuff japhy+perl@pobox.com
CPAN ID: PINYAN http://www.perl.com/CPAN/authors/id/P/PI/PINYAN/
------------------------------
Date: Tue, 02 Nov 1999 13:02:27 GMT
From: h.benne@library.uu.nl
Subject: Sort order in Perl
Message-Id: <7vmnc3$akn$1@news1.xs4all.nl>
Keywords: perl, sorting order
Hello,
This is probably a newbie question, but I do not know the answer and hopefully
somebody does.
I want to sort an array with names that contains diacritical characters in a
different way Perl does by default.
The order words are sorted by Perl is not the way I want it to be. The
diacritical character 'ö' for example is sorted after the 'z' and I want it to
be sorted as 'oe'. The same for 'ä' (ae) and 'ü' (ue). Is this possible ?
Thanks in advance,
Hugo Benne (h.benne@library.uu.nl)
------------------------------
Date: 2 Nov 1999 05:42:50 -0600
From: abigail@delanet.com (Abigail)
Subject: Re: string number conversion
Message-Id: <slrn81tjgk.ren.abigail@alexandra.delanet.com>
Uri Guttman (uri@sysarch.com) wrote on MMCCLIV September MCMXCIII in
<URL:news:x7904ha08o.fsf@home.sysarch.com>:
!! >>>>> "A" == Abigail <abigail@delanet.com> writes:
!!
!! A> () sub frac2dec {
!! A> () my ($dec,$num,$den) = shift =~
!! A> () m!^([^\s/]+)?\s*(?:([^\s/]+)/(.*))?$!;
!! A> () return $dec unless $num;
!! A> () die "Illegal division by 0, etc..." unless $den;
!! A> () return $dec + $num/$den;
!! A> () }
!!
!! A> It gives a warning on '4/5'.
!!
!! i thought i saw that but didn't try it. just put
!! $dec = 0 unless defined $dec
!! in there.
!!
!! i have a feeling the regex could be better too. it allows non digits and
!! doesn't check for failure.
!!
!! something like this looks better to me (tested)
!!
!! sub frac2dec {
!! return $1 if $_[0] =~ /^(\d+)$/ ;
!! return unless $_[0] =~ m|^(?:(\d+)\s+)?(\d+)/(\d+)| ;
!! return unless $3 ;
!! return $1 + $2/$3 if $1 ;
!! return $2/$3 ;
!! }
This one allows for leading and trailing spaces, spaces around the /,
dies with appropriate messages, defaults to use $_, has a cute final
expression, allows for an optional sign, and uses the same number
of lines:
sub frac2dec (;$) {
local $_ = @_ ? shift : $_;
/\d/ && m{^\s*([-+]?)\s*(\d*)\s*(?:(\d+)\s*/\s*(\d+))?\s*$} or
die "Not a fraction\n";
die "Illegal division by zero" if defined $3 && $3 == 0;
($1 eq '-' ? -1 : 1) * (($2 || 0) + ($3 || 0) / ($4 || 1));
}
Abigail
--
%0=map{reverse+chop,$_}ABC,ACB,BAC,BCA,CAB,CBA;$_=shift().AC;1while+s/(\d+)((.)
(.))/($0=$1-1)?"$0$3$0{$2}1$2$0$0{$2}$4":"$3 => $4\n"/xeg;print#Towers of Hanoi
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: 2 Nov 1999 05:49:32 -0600
From: abigail@delanet.com (Abigail)
Subject: Re: string number conversion
Message-Id: <slrn81tjt6.ren.abigail@alexandra.delanet.com>
Abigail (abigail@delanet.com) wrote on MMCCLIV September MCMXCIII in
<URL:news:slrn81tjgk.ren.abigail@alexandra.delanet.com>:
<>
<> sub frac2dec (;$) {
<> local $_ = @_ ? shift : $_;
<> /\d/ && m{^\s*([-+]?)\s*(\d*)\s*(?:(\d+)\s*/\s*(\d+))?\s*$} or
<> die "Not a fraction\n";
<> die "Illegal division by zero" if defined $3 && $3 == 0;
That line should read:
die "Illegal division by zero" if defined $4 && $4 == 0;
<> ($1 eq '-' ? -1 : 1) * (($2 || 0) + ($3 || 0) / ($4 || 1));
<> }
Abigail
--
Note to self: cut & paste *all* lines you change...
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: 2 Nov 1999 05:54:15 -0600
From: abigail@delanet.com (Abigail)
Subject: Re: Stripping live HTML into text
Message-Id: <slrn81tk63.ren.abigail@alexandra.delanet.com>
Mark (maggelet@mminternet.com) wrote on MMCCLIV September MCMXCIII in
<URL:news:381e922c.34407803@news.mminternet.com>:
[] The fastest way is sed.
[]
[] sed -e :a -e 's/<[^>]*>//g;/</N;//ba' filename >outfile
Bullshit. 'cat' is faster. And at least of cat it's instantly clear it's
broken, while a naief person might think the sed solution "works".
Abigail
--
Anyone who slaps a "this page is best viewed with Browser X" label
on a Web page appears to be yearning for the bad old days, before the
Web, when you had very little chance of reading a document written on
another computer, another word processor, or another network.
[Tim Berners-Lee in Technology Review, July 1996]
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: Tue, 2 Nov 1999 12:02:20 +0000
From: nick@webthing.com (Nick Kew)
Subject: Re: Stripping live HTML into text
Message-Id: <csjmv7.j8.ln@jarl.webthing.com>
> sed -e :a -e 's/<[^>]*>//g;/</N;//ba' filename >outfile
There are several bugs in that. Almost as quick, and essentially bug-free
lynx -dump filename > outfile
--
Nick Kew
------------------------------
Date: Tue, 2 Nov 1999 14:09:48 +0100
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Stripping live HTML into text
Message-Id: <Pine.HPP.3.95a.991102140359.27351F-100000@hpplus01.cern.ch>
On Tue, 2 Nov 1999, Nick Kew wrote:
> > sed -e :a -e 's/<[^>]*>//g;/</N;//ba' filename >outfile
>
> There are several bugs in that. Almost as quick, and essentially bug-free
>
> lynx -dump filename > outfile
The w3m text-mode browser does even better, especially if there are real
tables involved. (But its character code support is rather limited -
basically Japanese or Latin-1).
http://ei5nazha.yz.yamagata-u.ac.jp/~aito/w3m/eng/
On the other hand, if there are tables-for-graphical-layout involved,
Lynx's result from disregarding the tables is often better (authors
who wish to, can actually capitalise on this and produce pages that
are laid out nicely on a graphical browser, and laid out nicely but
differently on Lynx. I'm not saying that anyone _should_ do that, I'm
just mentioning it as an available option).
------------------------------
Date: Tue, 02 Nov 1999 11:47:37 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: undef()-fing multiple items at once
Message-Id: <3820cd42.2051943@news.skynet.be>
It is one of the annoying features of undef(), that it will work only on
one item at once. So this won't work:
undef($name,$age,$value,$path);
You "must" do this instead:
undef $name; undef $age; undef $value; undef $path;
which looks rather annoying.
But there is an alternative:
($name, $age, $value, $pat) = ();
Every scalar will be assigned the undefined value. It kinda works for
arrays and hashes too: it will assign the empty list to arrays and
hashes, which is, for most practical purposes, more than adequate.
--
Bart.
------------------------------
Date: 2 Nov 1999 08:08:37 -0500
From: catfood@apk.net (Mark W. Schumann)
Subject: Re: What makes the web go?
Message-Id: <7vmnol$q9b@junior.apk.net>
In article <brian-0211990123310001@155.new-york-58-59rs.ny.dial-access.att.net>,
brian d foy <brian@smithrenaud.com> wrote:
>In article <7vkkpn$fvr@junior.apk.net>, catfood@apk.net (Mark W. Schumann) wrote:
>
>>In article <brian-0111990248320001@134.new-york-61-62rs.ny.dial-access.att.net>,
>>brian d foy <brian@smithrenaud.com> wrote:
>>>In article <7vjbbi$hfi@junior.apk.net>, catfood@apk.net (Mark W. Schumann) wrote:
>>>> Perl is not Apache. Apache is not Perl.
>>>
>>>that's a little fuzzy, because my apache is perl ;)
>>
>>Hey, just because it's perl doesn't mean it's Perl.
>>
>>GeeeeeEEEEEeeeez. Newbies.
>
>who's a newbie? i can write Perl scripts in Apache as well as
>running them in Apache.
>
>be careful with your replies...
Who the hell is this Brian Foy guy anyway? Read a FAQ once in a while,
kid.
(Cool. I trolled Brian Foy. All in fun, dude.)
------------------------------
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 1252
**************************************