[12487] in Perl-Users-Digest
Perl-Users Digest, Issue: 6087 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jun 22 05:07:20 1999
Date: Tue, 22 Jun 99 02:00:24 -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 Tue, 22 Jun 1999 Volume: 8 Number: 6087
Today's topics:
Re: 2 simple (not to me tho) questions (Bart Lateur)
Re: [Req:] Date::Abigail (Abigail)
Re: A buggy intersection-method (Bart Lateur)
A general programming question <olmert@netvision.net.il>
Re: Cure for document deficiency <hasant@trabas.co.id>
Re: Docs for cmdline switches - where? (Abigail)
Re: fork on NT (Danny Aldham)
Re: Fun PERL JOB opening in Escondido, CA (Tad McClellan)
Re: how to sort uniq (Abigail)
Re: Interpreting MS-ASCII - anyone have a filter? (Bart Lateur)
Re: matinal musings and the madrugada <matt.sergeant@ericsson.com>
Re: matinal musings and the madrugada (David Cantrell)
Re: Need help with #exec cgi (Abigail)
Re: Need Perl Help? (programming/modify script/install (Tad McClellan)
Re: Newbie:VBQ (Very Basic Question) <JFedor@datacom-css.com>
Re: Newbie:VBQ (Very Basic Question) (Larry Rosler)
NON-BACK Help needed <bie@connect.ab.ca>
Obtaining values from a file <derek@realware.com.au>
Re: Obtaining values from a file <cschmitz@stud.informatik.uni-trier.de>
Re: Obtaining values from a file <derek@realware.com.au>
Re: Obtaining values from a file <derek@realware.com.au>
Re: perl help (Abigail)
Re: Perl scripts slows down servers? <matt.sergeant@ericsson.com>
Re: Piping through Less. <xyf@inetnebr.com>
Re: Safe expression evaluation <Marcel.vdLaan@ehv.sc.philips.com>
Re: Simple Question (I think) (Tad McClellan)
Re: Simple Question (I think) <JFedor@datacom-css.com>
Re: Simple Question (I think) <JFedor@datacom-css.com>
Re: sorting on 2 fields (Tad McClellan)
Re: sorting on 2 fields (Larry Rosler)
Re: Statistics for comp.lang.perl.misc (Lee)
Re: Statistics for comp.lang.perl.misc (Bart Lateur)
Re: VBScript vs PerlScript (Larry Rosler)
Re: What is First line in Perl5 in Sun Micro... (Abigail)
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 22 Jun 1999 08:36:15 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: 2 simple (not to me tho) questions
Message-Id: <37774a8f.3913680@news.skynet.be>
Weborium wrote:
>print "@animal"; #this gets c a t.
Try setting $" to the empty string before attempting that again.
Better yet: try setting it to something else.
$" = ")-(";
print "(@animal)";
>print @animal; #gets the length of the array.
Does it? Nah... perhaps you tried
print scalar @animal;
>I just want to print cat.
print join("",@animal);
You can do other things but printing, to, which makes this a useful
idiom to remember.
Bart.
------------------------------
Date: 22 Jun 1999 00:16:19 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: [Req:] Date::Abigail
Message-Id: <slrn7mu70s.k1b.abigail@alexandra.delanet.com>
Lee (rlb@intrinsix.ca) wrote on MMCXX September MCMXCIII in
<URL:news:B394004B9668E2912D@204.112.166.88>:
^^ Have you considered making your date functions available to the great
^^ unwashed masses? And may I request an update for WebTV time?
One of my sigs does.
Abigail
--
perl -MTime::JulianDay -lwe'@r=reverse(M=>(0)x99=>CM=>(0)x399=>D=>(0)x99=>CD=>(
0)x299=>C=>(0)x9=>XC=>(0)x39=>L=>(0)x9=>XL=>(0)x29=>X=>IX=>0=>0=>0=>V=>IV=>0=>0
=>I=>$r=-2449231+gm_julian_day+time);do{until($r<$#r){$_.=$r[$#r];$r-=$#r}for(;
!$r[--$#r];){}}while$r;$,="\x20";print+$_=>September=>MCMXCIII=>()'
-----------== 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, 22 Jun 1999 08:36:29 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: A buggy intersection-method
Message-Id: <377649af.3690026@news.skynet.be>
Greg Bacon wrote:
>It can be useful to lie to yourself about the contents of @ARGV.
>
> local @ARGV = ( '/some/file', 'ps auxww |' );
> while (<>) { ... }
Oh. That reminds me. I've tried this:
{
local *ARGV;
@ARGV = ('/some/file');
while(<>) {
...
}
}
but I noticed that localizing the filehandle ARGV (which was part of
what I wanted) mad it loose it's magic properties. I guess that by
default, ARGV is a tied handle, and no longer if localized. I just
thought I'd mention this.
Bart.
------------------------------
Date: Tue, 22 Jun 1999 05:11:49 GMT
From: Shaulmert <olmert@netvision.net.il>
Subject: A general programming question
Message-Id: <7kn5ug$v8t$1@nnrp1.deja.com>
Hello,
I am using ASP, but my question is a bit more general: I have to manage
HUGE amounts of data. what would be faster
for the server to do, dig it in and out of database tables, or in and
out of text files?
Also- what would be faster, to separate the data into many different DB
tables or text files, or to create one very long DB/text file? the
assumption is that if it will be separated, the CPu will have to handle
about six to ten actions in different files as oppose to the same amount
of actions on one long file?
Your insights will be greatly appreciate.
Please reply to olmert@netvision.net.il
Thanks!
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Tue, 22 Jun 1999 12:47:59 +0700 (JAVT)
From: Hasanuddin Tamir <hasant@trabas.co.id>
To: comp.lang.perl.misc@list.deja.com
Subject: Re: Cure for document deficiency
Message-Id: <Pine.LNX.3.96.990622121946.6267C-100000@borg.intern.trabas.co.id>
On Sun, 20 Jun 1999, Lee wrote:
rlb] In article <MPG.11d6990cc74b2d6b989751@206.184.139.132>,
rlb] moseley@best.com (Bill) wrote:
rlb]
rlb] >BTW -- If the documentation is so damn good, then why are those books so
rlb] >popular? Oh, I guess there is still room in this world for good
rlb] >teachers.
rlb]
rlb] I've been loathe to admit this, but I find on-screen documentation very
rlb] hard to follow. If I print it out readability improves, but you just can't
rlb] beat a properly typeset and bound book, so long as it has a good index.
rlb] (unfortunately, proper indexing is a near-dead art)
rlb]
rlb] Do others find this? Maybe it's something to do with the ADD.
IMHO.....,
The standard documentation is the first place
to look up. The books are some kind of other
approach toward understanding of the language.
Those (popular) books are written by people who
understand Perl very well inside outside, and I
bet they also read the documentations, both
the standard and non-standard (well, the source
code). In my other words, they are like extended
documentation.
Those (other not popular, `bad') books are contrary
written by people who merely (perhaps the best they
can do) copy the manual then pepper the title with
some kind of magic number (in days or so).
On screen documentation is shipped as part of the
package, that's what you have, like or not, while
you're not able to obtain the books (the popular
ones I mean) for whatever reason. And don't forget
that those books are the ones the recomended in
the manual. That's why they're like extended
documentation.
In my very personal opinion and perception, the
Perl manual (and FAQ) is the best manual among
others in my Linux box.
Of course, I'm not trying to say that I've understood
the whole docs very well.
-hasan-
Hasanuddin Tamir hasant@trabas.co.id
Meitraco Bahana Sejahtera www.trabas.co.id
=================================================
...and the news server screws up again :-(
------------------------------
Date: 21 Jun 1999 23:54:03 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Docs for cmdline switches - where?
Message-Id: <slrn7mu5n4.k1b.abigail@alexandra.delanet.com>
Mark Holmes (markh@mailandnews.com) wrote on MMCXX September
MCMXCIII in <URL:news:376E92F3.9AAB9CDD@mailandnews.com>:
__
__ Where can I find documentation for Perl's command line switches?
In the perlrun manpage.
__ I can't find this anywhere in the manpages or faqs. There are
__ scattered references (esp. for -w ;^) in the shipped docs but I
__ could see no official writeups for the switches shown on the very
__ first lines of perl.pod. I divined some like -d and -e but am
__ daring to want it all.
__
__ Also, I'm new to this NG and am wondering if y'all find it safe
__ to post with your real reply addresses?
It's considered rude to munge your address. And not only is it
rude, it isn't according to the RFC either.
__ Do the spambots haunt us
__ here?
Does it matter? The gods didn't invent procmail for no reason.
__ I'll look in the group for any replies to this post, but
__ to reply directly remove 'no.spam' from my address. I have
__ somehow managed to keep this mailbox completely spam-free and
__ want to savor the moment! Thx,
So, your address is markh@mailandnews.com? Right?
Let me write that down, markh@mailandnews.com.
Abigail
--
package Just_another_Perl_Hacker; sub print {($_=$_[0])=~ s/_/ /g;
print } sub __PACKAGE__ { &
print ( __PACKAGE__)} &
__PACKAGE__
( )
-----------== 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: 22 Jun 1999 04:05:21 GMT
From: danny@lennon.postino.com (Danny Aldham)
Subject: Re: fork on NT
Message-Id: <7kn221$ot4$1@lennon.postino.com>
X-Newsreader: TIN [version 1.2 PL2]
Philip DiFalco (phlippy@bellatlantic.net) wrote:
: when will fork() be available on NT?
Fork is available now using the tools from www.cygnus.com .
--
Danny Aldham Providing Certified Internetworking Solutions to Business
www.postino.com E-Mail, Web Servers, Mail Lists, Web Databases, SQL & Perl
------------------------------
Date: Mon, 21 Jun 1999 20:54:52 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Fun PERL JOB opening in Escondido, CA
Message-Id: <ssmmk7.24u.ln@magna.metronet.com>
mike@pec.net wrote:
: If this is not appropriate - let me know - yell as loud as you like!
This is not appropriate.
: Seriously, where can I post a job for a PERL programmer, as we need a
: good perler here in Escondido ASAP?
Any newsgroup with "jobs" in its name.
You might also try the Perl Monger's (user's group) if there
is one near you:
http://www.pm.org/
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: 21 Jun 1999 23:57:15 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: how to sort uniq
Message-Id: <slrn7mu5t5.k1b.abigail@alexandra.delanet.com>
xin zhou (zxwj@yahoo.com) wrote on MMCXXI September MCMXCIII in
<URL:news:7kmr17$kj63@sunami.kla-tencor.com>:
"" It seems the built-in sort function does not provide csh's sort -u.
"" As a new perl user, I had to write a block to achieve the effect. Can you
"" experienced guys write one of those crytic one-liners to do it?
Sure.
perl -wle 'print "I better read the FAQ before asking one.\n" while 1'
HTH. HAND.
Abigail
--
perl -MLWP::UserAgent -MHTML::TreeBuilder -MHTML::FormatText -wle'print +(
HTML::FormatText -> new -> format (HTML::TreeBuilder -> new -> parse (
LWP::UserAgent -> new -> request (HTTP::Request -> new ("GET",
"http://work.ucsd.edu:5141/cgi-bin/http_webster?isindex=perl")) -> content))
=~ /(.*\))[-\s]+Addition/s) [0]'
-----------== 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, 22 Jun 1999 08:36:28 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Interpreting MS-ASCII - anyone have a filter?
Message-Id: <3774476a.3108480@news.skynet.be>
Abigail wrote:
>() But yes. Windows uses a superset of ISO-Latin-1, AKA "Ansi", which is
>() the same as most Unices use.
>
>Which Unix uses the same set as Windows? All Unices I know use ISO-Latin-x
>(or Unicode) for some x.
I didn't say that. I said that Windows uses a superset of the standard
that many Unices use. And yes, it was chosen for compatibilty. Hence the
break with the DOS backward compatibility. If you ignore the extra
defined characters in SOME FONTS (not all!) in Windows, it IS
ISO-Latin-1.
Bart.
------------------------------
Date: Tue, 22 Jun 1999 09:27:45 +0100
From: Matt Sergeant <matt.sergeant@ericsson.com>
Subject: Re: matinal musings and the madrugada
Message-Id: <376F4901.A24D608A@ericsson.com>
Gregory Snow wrote:
>
> In article <376f006e.241042270@news.insnet.net>,
> David Cantrell <NukeEmUp@ThePentagon.com> wrote:
>
> > Having said that, I
> >always use YYYYMMDD when there is nothing better easily available. It
> >makes that code easier for those who have to maintain it later, and
> >prevents _me_ from making incorrect assumptions when coding at 4
> >o'clock in the morning.
>
> But that has y10k problems
Only if you truncate years > 9999
Matt.
------------------------------
Date: Tue, 22 Jun 1999 08:33:41 GMT
From: NukeEmUp@ThePentagon.com (David Cantrell)
Subject: Re: matinal musings and the madrugada
Message-Id: <376f482e.55057879@news.insnet.net>
On 21 Jun 1999 15:57:02 GMT, snow@biostat.washington.edu (Gregory
Snow) said:
>But that has y10k problems, isn't your hubris great enough to make you
>think that your scripts will still be being used in 8000 years? :-)
That _is_ documented, believe it or not! If anyone's still using perl
in 8000 years, I'd be more than happy to visit them and fix my code.
Because of laziness, I'll leave the travel arrangements up to them.
[Copying newsgroup posts to me by mail is considered rude]
--
David Cantrell, part-time Unix/perl/SQL/java techie
full-time chef/musician/homebrewer
http://www.ThePentagon.com/NukeEmUp
------------------------------
Date: 22 Jun 1999 01:03:33 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Need help with #exec cgi
Message-Id: <slrn7mu9pe.k1b.abigail@alexandra.delanet.com>
Dimensions (dimensions@dialaccess.com) wrote on MMCXXI September MCMXCIII
in <URL:news:ChEb3.453$M46.3440@newsfeed.slurp.net>:
!! I am running a "exec cgi" (SSI) as:
!!
!! <!--#exec cgi="/cgi-bin/myscript.cgi"-->
That has nothing to do with Perl.
Ask elsewhere, may I suggest alt.healing.flower-essence, which isn't
more off-topic for your question than this group is.
Abigail
--
perl -we 'print split /(?=(.*))/s => "Just another Perl Hacker\n";'
-----------== 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: Mon, 21 Jun 1999 20:24:40 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Need Perl Help? (programming/modify script/install script/ etc.)
Message-Id: <84lmk7.24u.ln@magna.metronet.com>
mark@bstar.net wrote:
: I'm a freelance programmer, and I can do whatever you need.
: Spammers will be prosecuted
That's rich! Coming from someone who makes commercial posts
to a discussion newsgroup.
You should guard your reputation a bit more carefully...
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Tue, 22 Jun 1999 03:59:08 -0400
From: "Jody Fedor" <JFedor@datacom-css.com>
Subject: Re: Newbie:VBQ (Very Basic Question)
Message-Id: <7kndv4$obl$1@plonk.apk.net>
Stuart, Xinlu and Niuniu wrote in message <376F11C8.9F7F0DED@tu.infi.net>...
>I just purchased a book "Perl 5 By Example" that came with perl5 on a
>cd. I installed it, it appears to be working. I typed print("blah blah
>blah ,\n"); in notepad and named it test.pl
>Tried to run it and nothing happened. I know this is beyond basic but I
>would appreciate any help I could get. I am doing all of this in the
>windows98 environment (if that even matters)
>
>-Stuart
Stuart,
How do you know it works if you can't get your program to work?
Perl 5 by Example doesn't say to use ( in a print statement.
try using: print "blah blah blah\n";
Are you using Perl on a unix system or windoz or dos? Every perl
program should start with the same line. Did yours start with it?
------------------------------
Date: Tue, 22 Jun 1999 01:40:16 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Newbie:VBQ (Very Basic Question)
Message-Id: <MPG.11d8ebc454a58b4b989c17@nntp.hpl.hp.com>
[Posted and a courtesy copy sent.]
In article <376F11C8.9F7F0DED@tu.infi.net> on Tue, 22 Jun 1999 00:32:08
-0400, Stuart, Xinlu and Niuniu <stannehi@tu.infi.net> says...
> I just purchased a book "Perl 5 By Example" that came with perl5 on a
> cd. I installed it, it appears to be working. I typed print("blah blah
> blah ,\n"); in notepad and named it test.pl
> Tried to run it and nothing happened. I know this is beyond basic but I
> would appreciate any help I could get. I am doing all of this in the
> windows98 environment (if that even matters)
It matters a great deal.
Run, do not walk, to <URL:http://www.activestate.com/>, and download and
install ActivePerl (which is free). After that, type
perl test.pl
(assuming the current directory is the one containing that file), and
all should be well. AsctiveState will also have installed all the Perl
docs in HTML form, accessible from your Start:Programs list.
PS: Your Subject stinks for several reasons.
PPS: Regards to Xinlu and Niuniu also.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Mon, 21 Jun 1999 12:46:15 -0600
From: Tim <bie@connect.ab.ca>
Subject: NON-BACK Help needed
Message-Id: <376E8877.2EAD@connect.ab.ca>
Hello,
I am making a game & I want to be able to stop the user from simply
pushing back on their
browser and trying again. How can I do this?
Tim
--
-------------------------------------------------------
| TBE: http://tbe.virtualave.net |
| * 3:2 Ratio + 100 Free credits! * |
| Tim's Chat Doors: http://www.connect.ab.ca/~mundy/ |
-------------------------------------------------------
------------------------------
Date: Tue, 22 Jun 1999 17:41:35 +1000
From: Derek Lavine <derek@realware.com.au>
Subject: Obtaining values from a file
Message-Id: <376F3E2F.2D072D00@realware.com.au>
Hi all
I have a file like this
This is some text, and %%var1%%="this is the first var"
more text, and %%var2%%="yet another variable"
%%var3%%="and now one more"
%%anyname%%="variables can have any name"
%%value%%=6
%%var3%%="this appears more than once"
I would like to write a function that takes a filename and optionally an
escaped variable name. And the function would read the file and return a
hash of variable names and their corresponding values. If no variable
name is specified when the function is called all escaped variables will
be read otherwise only the specified variable. The may be more than one
occurrence of a given variable name in the file and they should all be
added into the hash.
so with the above file the function would need to return a hash with the
following entries:
( var1 => "this is the first var"
, var2 => "yet another variable"
, var3 => "and now one more"
, anyname => "variables can have any name"
,value => 6
, var3 => "this appears more than once"
);
Many thanks
Derek
P.S. I am quite new to perl so please keep expliantions simple and don't
assume I know to much about reg expressions, thanks again.
------------------------------
Date: 22 Jun 1999 08:33:47 GMT
From: Christoph Schmitz <cschmitz@stud.informatik.uni-trier.de>
Subject: Re: Obtaining values from a file
Message-Id: <7knhpb$2rf$1@fu-berlin.de>
Derek Lavine <derek@realware.com.au> wrote:
: Hi all
: I have a file like this
: This is some text, and %%var1%%="this is the first var"
: more text, and %%var2%%="yet another variable"
: %%var3%%="and now one more"
: %%anyname%%="variables can have any name"
: %%value%%=6
: %%var3%%="this appears more than once"
: I would like to write a function that takes a filename and optionally an
: escaped variable name. And the function would read the file and return a
: hash of variable names and their corresponding values. If no variable
: name is specified when the function is called all escaped variables will
: be read otherwise only the specified variable. The may be more than one
: occurrence of a given variable name in the file and they should all be
: added into the hash.
: so with the above file the function would need to return a hash with the
: following entries:
: ( var1 => "this is the first var"
: , var2 => "yet another variable"
: , var3 => "and now one more"
: , anyname => "variables can have any name"
: ,value => 6
: , var3 => "this appears more than once"
: );
First of all, a hash cannot have to keys that are equal. Therefore,
var3 cannot appear twice. I resolved this using an arrayref as
hash values.
Here's my solution:
---------- snip ----------------------
#!/usr/bin/perl -w
use strict;
sub read_file {
my $filename = shift;
# the data structure I use is
# $result = {
# var1 => [ value1, value2, value3 ],
# var2 => [ value3, value4 ],
# }
# this is a hash _reference_ containing array _references_
# as keys... sorry, you'll have to read perldsc, perllol, perlref
# if you don't know what's going on here
my $result = {};
open FILE, "<$filename" or die "Can't read file";
undef $/; # slurp in the whole file at once
$_ = <FILE>;
my ($name, $value);
# hmmm... read perlop and perlre to figure this out ...
# the parens () surround the varname and the assigned
# values, which can later be referred to as $1 and $2
while ( m/.*%%(.*?)%%\s*=\s*\"(.*?)\"/g ) {
if (not exists $result->{$1}) {
$result->{$1} = [ $2 ];
} else {
push @{$result->{$1}}, $2;
}
}
return $result;
}
my $res = read_file ("text");
foreach ( keys %$res ) {
print "$_ => (" . join (",", @{$res->{$_}}) . ")\n";
}
---------- snip ----------------------
If you have any special questions about this, feel free to
email me personally.
Christoph
--
-- Christoph Schmitz <cschmitz(at)stud.informatik.uni-trier.de> --
As far as the laws of mathematics refer to reality, they are not
certain, and as far as they are certain, they do not refer to reality.
-- Albert Einstein
------------------------------
Date: Tue, 22 Jun 1999 18:51:49 +1000
From: Derek Lavine <derek@realware.com.au>
Subject: Re: Obtaining values from a file
Message-Id: <376F4EA5.953CCFA3@realware.com.au>
Christoph,
Thanks very much for your speedy help, I have not had chance to try it yet as
I am on my way home, but It looks very much like what I am after. And I can
just about work out from the example what is going on at the various points.
Thanks again, this sort of thing makes the learning of perl all the easier.
Regards
Derek
------------------------------
Date: Tue, 22 Jun 1999 18:52:38 +1000
From: Derek Lavine <derek@realware.com.au>
Subject: Re: Obtaining values from a file
Message-Id: <376F4ED6.F736EEA4@realware.com.au>
Christoph,
Thanks very much for your speedy help, I have not had chance to try it yet as
I am on my way home, but It looks very much like what I am after. And I can
just about work out from the example what is going on at the various points.
Thanks again, this sort of thing makes the learning of perl all the easier.
Regards
Derek
------------------------------
Date: 22 Jun 1999 00:11:38 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: perl help
Message-Id: <slrn7mu6o3.k1b.abigail@alexandra.delanet.com>
Sunitha (nsunitha@cse.unl.edu) wrote on MMCXX September MCMXCIII in
<URL:news:376E8EFA.1D1AE7F@cse.unl.edu>:
::
:: I am new to perl and am trying t dynamically create a hash table
:: from values from a file.
Why is this a followup to a posting called
'What is the First line in Perl5 in Sun Micro...'?
Perhaps you should fix your newsreader.
Abigail
--
sub f{sprintf$_[0],$_[1],$_[2]}print f('%c%s',74,f('%c%s',117,f('%c%s',115,f(
'%c%s',116,f('%c%s',32,f('%c%s',97,f('%c%s',0x6e,f('%c%s',111,f('%c%s',116,f(
'%c%s',104,f('%c%s',0x65,f('%c%s',114,f('%c%s',32,f('%c%s',80,f('%c%s',101,f(
'%c%s',114,f('%c%s',0x6c,f('%c%s',32,f('%c%s',0x48,f('%c%s',97,f('%c%s',99,f(
'%c%s',107,f('%c%s',101,f('%c%s',114,f('%c%s',10,)))))))))))))))))))))))))
-----------== 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, 22 Jun 1999 09:52:22 +0100
From: Matt Sergeant <matt.sergeant@ericsson.com>
Subject: Re: Perl scripts slows down servers?
Message-Id: <376F4EC6.AE647AA4@ericsson.com>
David Cassell wrote:
>
> Matt Sergeant wrote:
> > The recent example I'm thinking of are the perl vs Java vs Python for
> > XML parsing tests done on xml.com. Java was about 10-20% faster.
>
> Like I said. Isn't XML one of the areas where the Perl modules
> need work? Just a rumor I heard. Most of the fast-Java-example
> things I've heard about are the Java servlets running on a highly-
> optimized webserver system, vs Perl with no optimizations. Isn't
> this just one more such case?
Not quite. The "slowness" of Perl's XML::Parser (which really doesn't
need any serious _work_ - it's very very good, and very stable), is in
Perl's slow XS interface when making calls from XS->Perl (I think it's
that way round that's slow). XML parsing has to do a lot of this because
of the callback nature. We (the Perl-XML mailing list) were/are hoping
that the p5p people might pick up on this and do something about it.
> That's the trouble with anecdotal evidence. It's more than
> adequate to convince the True Believer. It's totally
> inadequate to answer the question. You'd never guess I'm a
> statistician, now would you? :-)
:)
Matt.
------------------------------
Date: Tue, 22 Jun 1999 02:21:27 -0500
From: ktb <xyf@inetnebr.com>
Subject: Re: Piping through Less.
Message-Id: <376F3977.F2F9CEA@inetnebr.com>
The result of this is the same as the other. Only one line gets read
into 'less' How can I get all lines to read into 'less'?
Thanks,
kent
Ronald J Kimball wrote:
>
> ktb <xyf@inetnebr.com> wrote:
>
> > I have the following script which works fine but I can't figure out how
> > to pipe the output from the program to 'less' on my Linux system so I
> > can view all the output.
>
> open(OUTPUT, "| less") or die "pipe error: $!\n";
>
> print OUTPUT "Hello world!\n"; # <-- your output goes here
>
> close(OUTPUT) or die "pipe error: $!\n";
>
> Read about open() in the perlfunc documentation for more info.
>
> --
> _ / ' _ / - aka -
> ( /)//)//)(//)/( Ronald J Kimball rjk@linguist.dartmouth.edu
> / http://www.tiac.net/users/chipmunk/
> "It's funny 'cause it's true ... and vice versa."
------------------------------
Date: Tue, 22 Jun 1999 08:49:52 +0200
From: "Marcel van der Laan" <Marcel.vdLaan@ehv.sc.philips.com>
Subject: Re: Safe expression evaluation
Message-Id: <930034182.363627@dibbs3.eur.cis.philips.com>
Tom Christiansen wrote in message <376e53d5@cs.colorado.edu>...
> [courtesy cc of this posting mailed to cited author]
>
>In comp.lang.perl.misc,
> "Marcel van der Laan" <Marcel.vdLaan@ehv.sc.philips.com> writes:
>:I am looking for a safe way to do expression evaluation
>
>Please see the {qcpan,mox}.c[lg]i scripts mentioned in
>
> http://language.perl.com/admin/whats_new.html
I'd like to, but the whole mox.perl.com site seems to be down, from where
I'm at. Is it mirrored anywhere?
>
>For examples of using a Safe compartment for this.
>
>--tom
>--
>If you take Fred Cohen's definition of virus, then Unix itself is
>one of the most successful viruses ever written, since it tends to
>result in the creation of modified versions of itself on other
>computer systems! -- Gene Spafford
Marcel.
------------------------------
Date: Mon, 21 Jun 1999 20:31:09 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Simple Question (I think)
Message-Id: <dglmk7.24u.ln@magna.metronet.com>
mkrier@my-deja.com wrote:
: All I want to do is (don't all of these perl
: questions start with those six words?) get a web
: page into a variable.
use LWP::Simple;
my $string = get('http://a/web/page.html');
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Tue, 22 Jun 1999 03:09:14 -0400
From: "Jody Fedor" <JFedor@datacom-css.com>
Subject: Re: Simple Question (I think)
Message-Id: <7knb1k$mql$1@plonk.apk.net>
mkrier@my-deja.com wrote in message <7kmac0$m3n$1@nnrp1.deja.com>...
>I don't want to load some mega-huge library with
>bells and whistles (a small one or just part of
>one would be ok), I just want to get a page into a
>$string.
>
>Thanks in advance,
>-Mike Krier
>krier@idt.net
>
Mike, you can slurp the file into a variable.
open (LOGS,"transfer_log") || die "Cannot open file transfer_log";
while ($rec=<LOGS>) {$log .=$rec};
print $log;
close (LOGS);
This might be "Perl Baby-Talk" but it will get the job done. I'm sure Larry
(Rosler) might have a million better ways to do this, he is the King of
Simplicity.
Hope this helps.
Jody
------------------------------
Date: Tue, 22 Jun 1999 04:12:02 -0400
From: "Jody Fedor" <JFedor@datacom-css.com>
Subject: Re: Simple Question (I think)
Message-Id: <7knena$omv$1@plonk.apk.net>
I guess a better question to have asked should have been:
Do you want to retrieve this file via http through the internet or
do you want the retrieve the file from files located on your hardrive?
Jody
------------------------------
Date: Mon, 21 Jun 1999 20:48:34 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: sorting on 2 fields
Message-Id: <2hmmk7.24u.ln@magna.metronet.com>
Jeff Epstein (exujep@exu.ericsson.se) wrote:
: I have Wins, Losses, Ties, PF (points for), etc. I'd like to sort on
: Wins-Ties-PF,
[snip]
: How do I sort so that the standings seen are C B A in this case?
: (C has the best record of 12-4, while A&B have identical records but B
: has
: more points.)
: I've looked at
: http://language.perl.com/newdocs/pod/perlfaq4.html#How_do_I_sort_an_array_by_anyth
: and it's associated links but I don't understand how to make it work.
Here are the two parts given in the FAQ put together for
your particular situation.
-----------------------
#!/usr/bin/perl -w
use strict;
my @data = <DATA>;
my @sorted = map { $_->[0] }
sort { $b->[1] cmp $a->[1] || # wins
$b->[3] cmp $a->[3] || # ties
$b->[4] cmp $a->[4] # points
}
map { [ $_, split /\|/ ] } @data;
foreach (@sorted) {
print;
}
__DATA__
TeamB|11|4|1|435
TeamA|11|4|1|430
TeamC|12|4|0|465
-----------------------
You should mess around with this some and see what happens.
What happens if you switch the "$b"s to "$a"s (and vice versa)?
What happens if you change some of the subscripts?
What is going on with that "[ $_, split /\|/ ]" part?
( see "anonymous array" in perlref.pod )
Good luck!
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Tue, 22 Jun 1999 01:19:57 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: sorting on 2 fields
Message-Id: <MPG.11d8e7047dee6bbc989c15@nntp.hpl.hp.com>
In article <2hmmk7.24u.ln@magna.metronet.com> on Mon, 21 Jun 1999
20:48:34 -0400, Tad McClellan <tadmc@metronet.com> says...
...
> sort { $b->[1] cmp $a->[1] || # wins
> $b->[3] cmp $a->[3] || # ties
> $b->[4] cmp $a->[4] # points
> }
> map { [ $_, split /\|/ ] } @data;
...
> __DATA__
> TeamB|11|4|1|435
> TeamA|11|4|1|430
> TeamC|12|4|0|465
...
> You should mess around with this some and see what happens.
>
> What happens if you switch the "$b"s to "$a"s (and vice versa)?
...
What happens if one of the teams has only 9 wins instead of 11 or 12?
[Possibly your brain turns into a pumpkin at 20:48:34. :-]
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Tue, 22 Jun 1999 02:20:31 -0500
From: rlb@intrinsix.ca (Lee)
Subject: Re: Statistics for comp.lang.perl.misc
Message-Id: <B394A36F9668157AA1@0.0.0.0>
In article <slrn7mu48j.k1b.abigail@alexandra.delanet.com>,
abigail@delanet.com (Abigail) wrote:
>Bart Lateur (bart.lateur@skynet.be) wrote on MMCXX September MCMXCIII in
><URL:news:376e9cd7.236836@news.skynet.be>:
>II
>II Abigails quoting starts with one of:
>II
>II * 2 identical non-word characters (but not space)
>II * a set of matching "parens", such as "()","<>","[]","{}"
>II * Two capital i's. I've seen this only once, and honestly, I think this
>II was a mistake.
>
>
>Do you really think I make mistakes like that?
Come, now, Abigail. You *are* human.
Aren't you?
Lee
------------------------------
Date: Tue, 22 Jun 1999 08:36:26 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Statistics for comp.lang.perl.misc
Message-Id: <377345f6.2736693@news.skynet.be>
Abigail wrote:
>II * Two capital i's. I've seen this only once, and honestly, I think this
>II was a mistake.
>
>Do you really think I make mistakes like that?
Ack! Again! It looks like you can pick the quoting for your current
reply.
But, otherwise, seen the mistakes in several of your other recent posts
("Why are you trying to read from a file that you have opened for
reading?"), I'd vote yes. :-)
Bart.
------------------------------
Date: Tue, 22 Jun 1999 01:29:12 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: VBScript vs PerlScript
Message-Id: <MPG.11d8e92c1242563989c16@nntp.hpl.hp.com>
In article <xEDb3.947$Xr2.47215@dfiatx1-snr1.gtei.net> on Tue, 22 Jun
1999 03:44:30 GMT, Andy Long <along@gte.net> says...
> In a VBScript an OLE event is:
>
> function MSCSExecute(config, orderform, context, flags)
> MSCSExecute = 1
> end function
>
> I tried the following in PerlScript:
>
> sub MSCSExecute {
> local($config, $orderform, $context, $flags);
> local($ret);
> $ret = 1
> return $ret;
> }
>
> However it does not seem to work, anyone got any ideas?
I've never seen a line of PerlScript before, nor do I know what 'it does
not seem to work' means to you. But as it seems to resemble (archaic)
Perl, the missing semicolon must have something to do with it.
For that matter, why not just use this:
sub MSCSExecute { 1 }
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 22 Jun 1999 00:09:00 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: What is First line in Perl5 in Sun Micro...
Message-Id: <slrn7mu6j2.k1b.abigail@alexandra.delanet.com>
Sai Chimakurty (saic@shirdi.corp.sun.com) wrote on MMCXX September
MCMXCIII in <URL:news:7kluu7$n6m$1@corpnews1.Corp.Sun.COM>:
%% Hi,
%%
%% I have a Perl5 script. I have in the first line
%% #!/usr/dist/exe/perl5 -w. But it doesn't seem to work. Can any
%% one help me in telling me the right path of putting in the
%% first line for perl5 program.
That depends where you have Perl installed. Common places are
/opt/perl/bin/perl, /usr/local/bin/perl and /usr/bin/perl.
But sometimes, it's as exotic as /net/crown/froot6/ABNA/perl/bin/perl.
Perhaps you should talk with your sysadmin.
Abigail
--
perl -we 'print split /(?=(.*))/s => "Just another Perl Hacker\n";'
-----------== 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: 12 Dec 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 Dec 98)
Message-Id: <null>
Administrivia:
Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing.
]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body. Majordomo will then send you instructions on how to confirm your
]subscription. This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.
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 6087
**************************************