[9535] in Perl-Users-Digest
Perl-Users Digest, Issue: 3129 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Jul 11 18:07:14 1998
Date: Sat, 11 Jul 98 15:00:19 -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 Sat, 11 Jul 1998 Volume: 8 Number: 3129
Today's topics:
Re: -w on production code (was Re: better way of gettin <mgregory@asc.sps.mot.com>
Re: A Email to WWW GaTeWaY, is there such a Thing? (David J. Riesbeck)
Re: Can C compiler make server scripts? <tchrist@mox.perl.com>
Re: Dejanews/closed lists/moderated groups/lists [Was: birgitt@my-dejanews.com
Does your Web host offer ....? megauser@my-dejanews.com
Re: extracting data out of html page, LWP::USerAgent <dubois@cooltrails.com>
Re: good research methods WAS Re: on the fly subs with (Ilya Zakharevich)
Re: hash's and a foreach - Can't do it? (Ronald J Kimball)
Re: I am an "antispam spammer"? <3srf@qlink.queensu.ca>
Re: new charter and moderator for comp.lang.perl.announ (Ilya Zakharevich)
Re: Perl CGI under NT4.0 problem (Robert M Bellavance)
Q: Installing Cryptix-1.16 in Windows95 <dmgl@dmgl.kirov.ru>
Re: question about objects <kloro@erols.com>
Re: question about objects (Ronald J Kimball)
Re: redux, step 1 (was Re: new charter and moderator fo <gnat@frii.com>
Re: redux, step 1 (was Re: new charter and moderator fo birgitt@my-dejanews.com
Re: Regular Expressions <kloro@erols.com>
Re: Single vs Double Quotes [was: Re: Abigail - Another <mgregory@asc.sps.mot.com>
Re: Single vs Double Quotes [was: Re: Abigail - Another (Ronald J Kimball)
Re: String to Ascii <uri@sysarch.com>
Re: String to Ascii <webmaster@RemoveThisToEmail.searchpoint.com>
Through PERL generating a WWW page. (newbie) <panagiot@frontiernet.net>
Re: Weirdness in trying to extract year from localtime Grehom@my-dejanews.com
Re: Weirdness in trying to extract year from localtime (Craig Berry)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 11 Jul 1998 15:08:59 +0930
From: Martin Gregory <mgregory@asc.sps.mot.com>
Subject: Re: -w on production code (was Re: better way of getting the last modified file?)
Message-Id: <r87m1lndzg.fsf@asc.sps.mot.com>
Russ Allbery <rra@stanford.edu> writes:
> Bart Lateur <bart.mediamind@tornado.be> writes:
>
> > But you're not consequent, IMO. You don't mind new warning messages
> > added with every new version of Perl. That is an unpredictable run-time
> > environment in my book. And the raison d'=EAtre of this whole thread.
>
> If you want a predictable runtime environment, you should hard-code the
> version of Perl you're running under into the #! line.
>
> Seriously.
If only it were possible to do _that_ in a path-independent fashion!
Martin.
------------------------------
Date: 11 Jul 1998 19:48:17 GMT
From: djr@frogpond.frognet.net (David J. Riesbeck)
Subject: Re: A Email to WWW GaTeWaY, is there such a Thing?
Message-Id: <6o8fi1$4e5$1@supernews.com>
|> : > Igor wrote:
|> : > > If you know where I can find email-to-www gateway (a-la Hotmail) so that
|> : > > I could read email from my Web Browser via HTTP, please email me.
|> :
Not sure if this is exactly what is wanted, but if we're talking simply
about reading mail from a web browser, check out:
http://frogmail.frognet.net
It's a simple CGI program written in Perl using the Mail::POP3Mail library
that can be found on CPAN sites. It supports any POP3 server. The interface is
rather homely, as it was thrown together in a matter of about 4 hours, but it's
acceptable.
There are smiliar programs, as well, that can be obtained from the usual
sources. (eg, http://www.perl.com).
--
David J. Riesbeck
Assistant Systems Administrator
FrogNet, Inc.
------------------------------
Date: 11 Jul 1998 21:06:40 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Can C compiler make server scripts?
Message-Id: <6o8k50$3t2$1@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc, krzych@altavista.net writes:
:I use C Complier Kit by Malcolm Beattie.I tried to convert perl scripts into
:C and later into executable file. The reason why I did this I wanted to hide
:my Perl code and to make it difficult to understand.
And you honestly expect us to help you do that? Why?
--tom
--
Just don't create a file called -rf. :-)
--Larry Wall in <11393@jpl-devvax.JPL.NASA.GOV>
------------------------------
Date: Sat, 11 Jul 1998 19:02:35 GMT
From: birgitt@my-dejanews.com
Subject: Re: Dejanews/closed lists/moderated groups/lists [Was: Re: Is perl5-porters closed to subscription?
Message-Id: <6o8csb$llb$1@nnrp1.dejanews.com>
In article <35a80f9a.155274217@news.op.net>,
sonny-lives-in-our-hearts@IDONTLIKESPAMjuno.com (The Sonny Bono Internet
Tribute Committee) wrote:
> On 10 Jul 1998 13:38:16 GMT, Tom Christiansen <tchrist@mox.perl.com>
> wrote:
>
> > [courtesy cc of this posting sent to cited author via email]
> >
> >In comp.lang.perl.misc, Russ Allbery <rra@stanford.edu> writes:
> >:Copyright violations are, so far as I know, always civil complaints,
> >
> >They needn't be. It's now a criminal offence.
>
> Citation?
>
Oops, I am more than satisfied with the responses I got. I am a bit
worried to become the originator of an off-topic thread here which
I didn't intend.
It just happened that I witnessed someone posting a private email
response back to a NG for which it was clear that there was no consent
given by the author. Before giving in to the urge to post something
what most of you would consider an attempt to 'straighten' out the
poster I wanted to clear if my personal judgement was round about right.
Thanks for the replies.
Birgitt Funk
> --
> The opinions of this poster do not necessarily reflect the
> views of the Sonny Bono Internet Tribute Committee.
>
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: Sat, 11 Jul 1998 19:39:22 GMT
From: megauser@my-dejanews.com
Subject: Does your Web host offer ....?
Message-Id: <6o8f1a$occ$1@nnrp1.dejanews.com>
Does your web host offer An online editor which allows for HTML,JavaScript,
Java,C/C++,DHTML etc. Plus have integrated Tutorials,Chats,References,and
Newsgroups to help you out along the way? Push button compiling and Debugging
of Server Side Scripts? Push button HTML and JavaScript Preview? Easy to use
web integrated Web site managment?
Plus...Support for Primary and Secondary domains?
Here is one that does...all in one place....No Unix is required...30 day free
trial.
http://www.useractive.com
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: Sat, 11 Jul 1998 12:06:39 -0700
From: Denis Du Bois <dubois@cooltrails.com>
Subject: Re: extracting data out of html page, LWP::USerAgent
Message-Id: <35A7B7BF.6BDA@cooltrails.com>
I am trying to do something similar to what Abigail is trying. I can't
find documentation for LWP::UserAgent and HTTP::request, etc.
Do you know where to find it (a) online, or (b) a decent book on it?
Thanks++
Denis
webmaster@cooltrails.com
Abigail wrote:
>
> dwiesel@my-dejanews.com (dwiesel@my-dejanews.com) wrote on MDCCLXXIV
> September MCMXCIII in <URL: news:6o5sln$7ij$1@nnrp1.dejanews.com>:
> ++ Hallo.
> ++
> ++ I would like to extract some data out of a html page. I know how to get the
> ++ information about the first title but not *every* book.
> ++
> ++ The result I'm looking for is a hash with the name of the book as a key and
> ++ and the value should be a pointer to an array with the rest of the data.
>
> Please ask in a different group, Perl does not have pointers.
>
> ++ if (connect SOCKET, sockaddr_in(80, inet_aton("$host")))
> ++ {
> ++ select SOCKET; $| = 1; select STDOUT;
> ++ print SOCKET "GET $adress\n\n";
> ++
> ++ $text .= $rad while $rad = <SOCKET>;
> ++ close SOCKET;
>
> Perhaps you want LWP::UserAgent?
>
> ++ # This only works on the first line... (yeah... I'm really bad at this)
> ++ $text =~ /<TD VALIGN=\"TOP\">(.*)<\/TD>/; $firsttitle = $1; }
>
> That assumes many things about the text which probably aren't true.
>
> Perhaps you want HTML::Parser?
>
> Abigail
> --
> perl -wle '$, = " "; sub AUTOLOAD {($AUTOLOAD =~ /::(.*)/) [0];}
> print+Just (), another (), Perl (), Hacker ();'
------------------------------
Date: 11 Jul 1998 20:37:08 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: good research methods WAS Re: on the fly subs with special tag markers
Message-Id: <6o8idk$rt8$1@mathserv.mps.ohio-state.edu>
[A complimentary Cc of this posting was sent to Mark Stang
<mark$$$stang@ncgroup.com>],
who wrote in article <6o2ku4$p46$1@usenet1.interramp.com>:
> I fully expect to be flamed for this, but is there a cross referenced,
> indexed, searchable, hyperlinked version of the perl docs?
Yes. EMX Perl distribution comes with one (readable on OS/2 -
natively, and Win* and DOS). See README.os2 for the location of Win*
viewers, DOS viewers are native starting from IBM's DOS 7.0.
Ilya
------------------------------
Date: Sat, 11 Jul 1998 16:50:44 -0400
From: rjk@coos.dartmouth.edu (Ronald J Kimball)
Subject: Re: hash's and a foreach - Can't do it?
Message-Id: <1dc0gmc.1piyazx1k9hc1sN@bay1-466.quincy.ziplink.net>
<jevon@my-dejanews.com> wrote:
> I tried a push but I can't push a hash..
I'm afraid I didn't follow your explanation of what you wanted to do,
but array is to push as hash is to $hash{$key} = $value;.
Does that help?
--
_ / ' _ / - aka - rjk@coos.dartmouth.edu
( /)//)//)(//)/( Ronald J Kimball chipmunk@m-net.arbornet.org
/ http://www.ziplink.net/~rjk/
"It's funny 'cause it's true ... and vice versa."
------------------------------
Date: 11 Jul 1998 15:09:34 GMT
From: Frampton Steve R <3srf@qlink.queensu.ca>
Subject: Re: I am an "antispam spammer"?
Message-Id: <6o7v7e$ovu$1@knot.queensu.ca>
In news.admin.net-abuse.email Bob Trieger <sowmaster@juicepigs.com> wrote:
: I think it is even ruder than the morons with munged addresses. They are so
: stupid they don't have a clue that they are being rude.
Excuse me, but this just pisses me off. Just who the fuck are *you* to
dictate what a person may do with their private resources? If somebody
mungs their address, and you don't like it, then *DON'T SEND THEM ANY
FUCKING E-MAIL*. Answering a question for somebody is supposed to be an
act of altruism. If you're so altruistic, then I'm sure taking the extra
30 seconds to de-mung isn't such a big deal. If not, then why are you
bothering to respond? (Perhaps it is to inflate your ego by
demonstrating your indepth knowledge of the topic being discussed)
Munging is an effective way of thwarting spam. Trust me, I know because I
use to be spammed from hell to highwater -- but after munging for about a
year or so, my spam count dropped to only 1 or 2 a day. I'm an end-user
at a captive ISP -- a University -- they don't support filtering, they
don't support procmail, etc. (No, I'm not allowed to install filtering
software nor procmail. In addition, I have a 2 MB disk quota so the point
is moot, anyway. No, I will not install end-client software. I read my
e-mail on the server with Pine by *choice*). In this case, munging was a
quick-and-easy solution for me.
P.S. I no longer mung -- as a result, my spam count is *way* up. Was it
because of morons like you flaming me for it? Nope! The reason I no
longer mung is because I decided I wanted to get righteous and LART every
spam that comes my way. But I *used* to mung, and completely understand
the point of view, and support the rights of those who choose to do so.
It makes things a bit more inconvenient for me, but I take comfort in
knowing that it makes things a bit more inconvenient for spammers as well.
Follow-ups set. This has *NOTHING* to do with Perl.
--------------< LINUX: The choice of a GNU generation. >--------------
Steve Frampton <3srf@qlink.queensu.ca> http://qlink.queensu.ca/~3srf
------------------------------
Date: 11 Jul 1998 20:31:03 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: new charter and moderator for comp.lang.perl.announce
Message-Id: <6o8i27$r8a$1@mathserv.mps.ohio-state.edu>
[A complimentary Cc of this posting was sent to Russ Allbery
<rra@stanford.edu>],
who wrote in article <m3emvs48l9.fsf@windlord.Stanford.EDU>:
> > What about C compilers - used to _build_ the perl interpreter?
>
> No.
Well, I see a place for an announcement like this:
A bug in gcc 2.8.1 breaks the perl's build.
(BTW, is it true on all the platforms?).
Ilya
------------------------------
Date: Sat, 11 Jul 1998 19:34:57 GMT
From: bbell@hpcc01.corp.hp.com (Robert M Bellavance)
Subject: Re: Perl CGI under NT4.0 problem
Message-Id: <243650012@hpcc01.corp.hp.com>
I have the same server setup. I used shell-cgi NOT cgi-bin to run
windows scripts. Make sure your mime types are setup correctly. It's
covered in the on line docs.
------------------------------
Date: Sat, 11 Jul 1998 22:43:25 +0400
From: "D" <dmgl@dmgl.kirov.ru>
Subject: Q: Installing Cryptix-1.16 in Windows95
Message-Id: <35a7b246.0@rapeme.kirov.ru>
Dear Sir/Madam
Please, help
How can I embed C library (bn_mul.c from Math-BigInteger) to my Perl in
Windows95?
How can I install Math-TrulyRandom module with *.c, *.h,*.bs,*.def,*.tc,*.xs
files?
Thank You in advance
Best wishes
------------------------------
Date: Sat, 11 Jul 1998 14:16:07 -0400
From: tom arnall <kloro@erols.com>
To: "F.Quednau" <quednauf@nortel.co.uk>
Subject: Re: question about objects
Message-Id: <35A7ABE7.6800DE47@erols.com>
dear colleague,
yes, i've done work with this kind of set up. but i have one problem with
it. when the browser interprets the html file, references to the real
site are taken literally. for testing purposes, of course, i want
references to the real site to be directed to the local host. my solution
was to put the local address (127.0.0.1) in the files while i was
testing, then edit them to replace the local host addr' w' with the addr
of the real site. any better ideas?
also, i am in process of doing research towards putting up a database
management site (sql compliant). i want to use perl as the link between
the database engine and the html files. one of the questions is, of
course, the test bed. do you think that a windows environment can handle
this?
the final product in para's 1 and 2 ended (will end) up on a linux site.
--
thanks,
tom arnall
accokeek, md
usa
---------------------------------------------------------------
F.Quednau wrote:
> Russ Allbery wrote:
> >
>
> > Ew. I'd never write either. It saves so much typing to just write:
> >
> > print while <blah>;
> >
> And is it dangerous to have
>
> print <blah>;
> for that matter ?
>
> --
> ____________________________________________________________
> Frank Quednau
> http://www.surrey.ac.uk/~me51fq
> ________________________________________________
------------------------------
Date: Sat, 11 Jul 1998 16:50:45 -0400
From: rjk@coos.dartmouth.edu (Ronald J Kimball)
Subject: Re: question about objects
Message-Id: <1dc0gzu.14kqlrl6ylqyyN@bay1-466.quincy.ziplink.net>
Bart Lateur <bart.mediamind@tornado.be> wrote:
> Because sometimes, the behaviour is correct, but you get a warning, and
> by fixing it, it's wrong.
>
> There have been examples posted in this thread, I think. One involves
> getting rid of a "variable used only once" warning, which got fixed by
> adding a "my" statement. Unfortunately, this changed the behaviour from
> using a global variable, as was intended, into a local (sortof).
Which is a very bad example, because the correct way to fix that warning
is 'use vars', not 'my'.
"I tried to fix my broken finger by chopping off my arm, and now I can't
use my hand anymore. So I've decided that it's better to ignore a
broken finger than to try to fix it."
--
_ / ' _ / - aka - rjk@coos.dartmouth.edu
( /)//)//)(//)/( Ronald J Kimball chipmunk@m-net.arbornet.org
/ http://www.ziplink.net/~rjk/
"It's funny 'cause it's true ... and vice versa."
------------------------------
Date: 11 Jul 1998 15:21:34 -0600
From: Nathan Torkington <gnat@frii.com>
Subject: Re: redux, step 1 (was Re: new charter and moderator for comp.lang.perl.announce)
Message-Id: <5qemvs3wyp.fsf@prometheus.frii.com>
Randal Schwartz <merlyn@stonehenge.com> writes:
> Right. I cannot see how thousands of readers of CLPA can fully trust
> me to "do the right thing" about posting my own or a competitors
> commercial product. I don't want to ask for that level of trust
> either.
Frankly, this is one of the simpler things that someone can be trusted
to do. The moderator of comp.lang.perl.announce is not working with
HIV infected blood, does not have anyone anaesthetized on the
operating table, is not designing or launching nuclear-powered
spacecraft. This isn't rocket science, it's basic character 101.
Putting the collective before the individual sounds Borgian but it's
very human. Hell, I'm offering to be the unpaid no-glory moderator
(and being opinionated about the charter) because I want to do what's
best for The Perl Community (shining lights, hallelujah chorus, and
give yourselves a hand, folks). I'm a very low-paid Unix sysadmin who
occasionally teaches for Tom and who loves Perl with a passion, not a
genetically altered lab mouse planning to take over the world.
Did I emphasize enough that it's not brain surgery? :-)
Nat
------------------------------
Date: Sat, 11 Jul 1998 21:15:26 GMT
From: birgitt@my-dejanews.com
Subject: Re: redux, step 1 (was Re: new charter and moderator for comp.lang.perl.announce)
Message-Id: <6o8kle$11h$1@nnrp1.dejanews.com>
In article <8cww9l8pvr.fsf_-_@gadget.cscaper.com>,
Randal Schwartz <merlyn@stonehenge.com> wrote:
>
> Some minor issues:
>
> Must be in CPAN, vs. can be anywhere, vs. should encourage CPAN
> Books/Magazines/Columns? (Unless they're free, subject to commercial above)
Is this meant to be books published in English only or books worldwide?
Every new edition ? Where go the reviews ?
> Web sites? (And then how "perly" does it have to be?)
Again, all ? Sites written in other languages besides English ?
> Job Postings? Resumes? (Cans of Worms? :)
>
I wonder what the reasons may be that people feel it might be necessary
to post resumes here. Can't anyone link in his signature to his home site
and post a resume there ? There are so many more telling things
about a person than a resume. Just wondering, why resumes?
Job Postings ? How many do you expect coming in ? Can they be bundled
in a biweekly list or so ?
I don't have an objective reason not to like reading them in something
like c.l.p.m., but if they have to be there then I would prefer to
have them rather in c.l.p.announce than in c.l.p.misc.
Birgitt Funk
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: Sat, 11 Jul 1998 13:54:44 -0400
From: tom arnall <kloro@erols.com>
To: Azman Shariff <azman@bnex.com>
Subject: Re: Regular Expressions
Message-Id: <35A7A6E4.21305224@erols.com>
ditto on rec's of friedl book - christiansen said it taught him things
about Perl (sic!) - better than the Camel for regex
Azman Shariff wrote:
> Just one small question
>
> sub where can i learn more about regular expressions{
> if it is from the manpages of perl {
> please do tell me exactly how to use them;
> thank you;
> }
> else {
> could some kind soul point me somewhere?;
> }
> }
>
> :)
>
> Azman Shariff
> ps: just to add some spice :)
--
thanks,
tom arnall
accokeek, md
usa
------------------------------
Date: 11 Jul 1998 15:03:29 +0930
From: Martin Gregory <mgregory@asc.sps.mot.com>
Subject: Re: Single vs Double Quotes [was: Re: Abigail - Another Question for you.]
Message-Id: <r8af6hne8m.fsf@asc.sps.mot.com>
Zenin <zenin@bawdycaste.org> writes:
> William R. Ward <hermit@cats.ucsc.edu> wrote:
> : Isn't it also faster to use single quotes, as the interpreter can then
> : know it doesn't have to scan for metacharacters such as $ or \ to
> : interpolate?
>
> It still has examine each char (think about ending "'", '\'', etc):
>
> $ perl foo.pl 100000
> Benchmark: timing 100000 iterations of LongDouble, LongSingle, ShortDouble,
> ShortSingle...
> LongDouble: 61 wallclock secs (55.43 usr + 0.07 sys = 55.50 CPU)
> LongSingle: 53 wallclock secs (51.17 usr + 0.09 sys = 51.27 CPU)
> ShortDouble: 41 wallclock secs (37.42 usr + 0.95 sys = 38.38 CPU)
> ShortSingle: 46 wallclock secs (42.98 usr + 0.04 sys = 43.02 CPU)
>
> Results go from single to double and back, depending on the
> exact phase of the moon.
>
> use Benchmark;
>
> timethese shift || 100, {
> ShortSingle => sub {
> eval q(
> my $string = 'AAAAAAA';
> );
> },
> ShortDouble => sub {
> eval q(
> my $string = "AAAAAAA';
> );
Given that the above string is improperly terminated, how in the heck
does this benchmark script even run?
(It does, and gives the results quoted above).
Martin.
------------------------------
Date: Sat, 11 Jul 1998 16:50:41 -0400
From: rjk@coos.dartmouth.edu (Ronald J Kimball)
Subject: Re: Single vs Double Quotes [was: Re: Abigail - Another Question for you.]
Message-Id: <1dc0ggb.6uuvr11neagr6N@bay1-466.quincy.ziplink.net>
Martin Gregory <mgregory@asc.sps.mot.com> wrote:
> > ShortDouble => sub {
> > eval q(
> > my $string = "AAAAAAA';
> > );
>
> Given that the above string is improperly terminated, how in the heck
> does this benchmark script even run?
>
> (It does, and gives the results quoted above).
The syntax error is contained in an eval string. The error returned by
eval is being ignored.
--
_ / ' _ / - aka - rjk@coos.dartmouth.edu
( /)//)//)(//)/( Ronald J Kimball chipmunk@m-net.arbornet.org
/ http://www.ziplink.net/~rjk/
"It's funny 'cause it's true ... and vice versa."
------------------------------
Date: 11 Jul 1998 14:14:49 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: String to Ascii
Message-Id: <x790m0ntk6.fsf@sysarch.com>
>>>>> "LR" == Larry Rosler <lr@hpl.hp.com> writes:
LR> [This followup was posted to comp.lang.perl.misc and a copy was sent to
LR> the cited author.]
>> Ken <webmaster@RemoveThisToEmail.searchpoint.com> wrote:
>>
>> > I am looking for a way to convert a string (a name) to ASCII code. The
>> > problem with using ord() is that it only returns the code for the first
>> > character. I am sure there is a way to use a loop to do this but my attempts
>> > have failed.
>>
LR> timethese (1 << 14, {
LR> Cntrl => sub { $_ = "abcdef\nABC"; },
LR> Join => sub { $_ = "abcdef\nABC";
LR> $_ = join ' ', map ord, split ''; },
LR> Regex => sub { $_ = "abcdef\nABC";
LR> s/(.)/ord($1) . ' '/eggs; },
LR> } );
LR> Benchmark: timing 16384 iterations of Cntrl, Join, Regex...
LR> Cntrl: 0 secs ( 0.26 usr 0.00 sys = 0.26 cpu)
LR> (warning: too few iterations for a reliable count)
LR> Join: 12 secs ( 6.24 usr 0.02 sys = 6.26 cpu)
LR> Regex: 15 secs ( 6.64 usr 0.02 sys = 6.66 cpu)
LR> The functional approach wins again, but not by much.
haven't you boys learned about pack/unpack yet? :-)
simplest and fastest way to convert ascii to ord.
uri
#!/usr/local/bin/perl
use Benchmark;
$_ = "abcdef\nABC" ;
timethese (1 << 12, {
unpack => sub { $a = join ' ', unpack( 'c*', $_ ) ; },
Join => sub { $a = join ' ', map ord, split ''; },
Regex => sub { ($a = $_ ) =~ s/(.)/ord($1) . ' '/eggs; },
} );
Benchmark: timing 4096 iterations of Join, Regex, unpack...
Join: 4 secs ( 3.68 usr 0.00 sys = 3.68 cpu)
Regex: 6 secs ( 5.48 usr 0.00 sys = 5.48 cpu)
unpack: 3 secs ( 3.01 usr 0.00 sys = 3.01 cpu)
--
Uri Guttman ----------------- SYStems ARCHitecture and Software Engineering
Perl Hacker for Hire ---------------------- Perl, Internet, UNIX Consulting
uri@sysarch.com ------------------------------------ http://www.sysarch.com
The Best Search Engine on the Net ------------- http://www.northernlight.com
------------------------------
Date: Sat, 11 Jul 1998 19:42:40 GMT
From: "Ken" <webmaster@RemoveThisToEmail.searchpoint.com>
Subject: Re: String to Ascii
Message-Id: <QePp1.1804$xs3.814944@news.rdc1.bc.wave.home.com>
Thanks everyone, that got it working!
Ken
Uri Guttman wrote in message ...
>>>>>> "LR" == Larry Rosler <lr@hpl.hp.com> writes:
>
> LR> [This followup was posted to comp.lang.perl.misc and a copy was sent
to
> LR> the cited author.]
>
<snip>
------------------------------
Date: 11 Jul 1998 20:58:27 GMT
From: Evan Panagiotopoulos <panagiot@frontiernet.net>
Subject: Through PERL generating a WWW page. (newbie)
Message-Id: <35A7CFAD.5B6A2000@frontiernet.net>
This is a multi-part message in MIME format.
--------------364797035CD2330DA5A5A1F2
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Hello,
I have a couple of PERL books that explain everything except how to
use perl in an interactive environment. Can you help with a very
simple example? Maybe you can point me to a web page where this type
of information is shown.
Thanks,
Evan P...
--------------364797035CD2330DA5A5A1F2
Content-Type: text/x-vcard; charset=us-ascii; name="vcard.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Evan Panagiotopoulos
Content-Disposition: attachment; filename="vcard.vcf"
begin: vcard
fn: Evan Panagiotopoulos
n: Panagiotopoulos;Evan
org: Valley Cental High School
email;internet: panagiot@frontiernet.net
title: Computer teacher
x-mozilla-cpt: ;0
x-mozilla-html: TRUE
version: 2.1
end: vcard
--------------364797035CD2330DA5A5A1F2--
------------------------------
Date: Sat, 11 Jul 1998 17:49:37 GMT
From: Grehom@my-dejanews.com
Subject: Re: Weirdness in trying to extract year from localtime
Message-Id: <6o88jh$ftm$1@nnrp1.dejanews.com>
May be that you're not taking all the spaces into account! might be better to
say:
$z = (split /\s+/, localtime)[5];
or:
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
In article <35A675F9.29324E54@us.oracle.com>,
Allen Choy <achoy@us.oracle.com> wrote:
> I'm having this weird occurence with extracting the year from localtime.
>
> Here's the code:
>
> 1. $z = (split / /, localtime)[4];
>
> However, there were times where
>
> 2. $z = (split / /, localtime)[5];
>
> would get me the year, and 1) wouldn't, and visa-versa.
>
> Anyone has a clue what's going on?
>
> Thanks in advance,
>
> Allen
>
>
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: 11 Jul 1998 19:07:32 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Weirdness in trying to extract year from localtime
Message-Id: <6o8d5l$o6v$1@marina.cinenet.net>
I wrote:
: > Albert W. Dorrington (awdorrin@mail.delcoelect.com) wrote:
: > : Using the code:
: > :
: > : $year = localtime[5] + 1900;
: >
: > That actually needs to be (localtime)[5] .
Allen Choy (achoy@us.oracle.com) replied, using nonstandard quoting order:
: Don't I get into a Y2K problem if I add 1900?
No, you get out of one. Seriously, what do you mean?
---------------------------------------------------------------------
| Craig Berry - cberry@cinenet.net
--*-- Home Page: http://www.cinenet.net/users/cberry/home.html
| Member of The HTML Writers Guild: http://www.hwg.org/
"Every man and every woman is a star."
------------------------------
Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Mar 97)
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.
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 3129
**************************************