[13086] in Perl-Users-Digest
Perl-Users Digest, Issue: 496 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Aug 13 02:07:22 1999
Date: Thu, 12 Aug 1999 23:05:16 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Thu, 12 Aug 1999 Volume: 9 Number: 496
Today's topics:
A CGI/Perl Question <pat4b@hongkong.com>
Re: A CGI/Perl Question (Abigail)
Bits and Bytes ... <hedin@wizcom.ru>
Re: Browser detection - write different html (Filip M. Gieszczykiewicz)
Re: Database conversion (Abigail)
Re: Embedding Perl (Abigail)
Re: Fastest form of an 'if' (Abigail)
Re: Help, please: use/require (not the (V)FAQ) (Sam Holden)
Re: Help, please: use/require (not the (V)FAQ) (Ronald J Kimball)
Re: Looking for a good Perl Book (David H. Adler)
Re: Looking for a good Perl Book (David H. Adler)
Re: Looking for a good Perl Book (David H. Adler)
Re: Looking for a good Perl Book <buddy.wright@toolsandmetals.com>
Looking for a solution to the problem localtime and the <Jack.Alexander@digital.com>
Re: Looking for a solution to the problem localtime and (Larry Rosler)
Re: My attempt at perl poetry (Ct60)
Re: Nastiness contrary to the spirit of perl? (Stevie Strickland)
Re: Need Help with regular expression (Ronald J Kimball)
Re: New Book on Perl Tool Development (Randal L. Schwartz)
Pedagogical Exercise w/ Symbol Table (K)
Re: Perl Novice needs advice (David H. Adler)
Re: Perl vs. ASP: which is better? (Donovan Rebbechi)
question: making nice looking tables using CGI.pm ? (Id Est)
Re: reference to object method <dchrist@dnai.com>
Re: regexp question - dealing w/ 2 strings <bwalton@rochester.rr.com>
Re: regexp question - dealing w/ 2 strings (Larry Rosler)
Re: Why doesn't this Pass by Reference work? (Sam Holden)
Re: Why doesn't this Pass by Reference work? <uri@sysarch.com>
Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 13 Aug 1999 12:43:26 +0800
From: "Patrick" <pat4b@hongkong.com>
Subject: A CGI/Perl Question
Message-Id: <7p07ps$3li$1@imsp009a.netvigator.com>
What command should I use to get the variable , which store the URL from
which I came from? (from where,th URL , to the CGI script)
Thanks.
Patrick
dbs2pat@netvigator.com
ICQ:8882328
------------------------------
Date: 13 Aug 1999 01:03:59 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: A CGI/Perl Question
Message-Id: <slrn7r7d9t.e7v.abigail@alexandra.delanet.com>
Patrick (pat4b@hongkong.com) wrote on MMCLXXIII September MCMXCIII in
<URL:news:7p07ps$3li$1@imsp009a.netvigator.com>:
## What command should I use to get the variable , which store the URL from
## which I came from? (from where,th URL , to the CGI script)
I'd use pen and paper, and write down the URL before you leave.
Abigail
--
sub A::TIESCALAR{bless\my$x=>A};package B;@q=qw/Hacker Another
Perl Just/;use overload'""'=>sub{pop @q};sub A::FETCH{bless\my
$y=>B}; tie my $shoe => 'A';print "$shoe $shoe $shoe $shoe\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: Fri, 13 Aug 1999 13:08:05 +0900
From: Victor Alekhin <hedin@wizcom.ru>
Subject: Bits and Bytes ...
Message-Id: <Pine.LNX.4.10.9908131305370.880-100000@unix.telco.ru>
Is it possible to write a perl script that
will make something like:
mov al,ByteData
xor al,255
mov cx,8
@1: rcl al,1
rcr ah,1
loop @1
mov ByteData,ah
---
Victor Alekhin, Irkutsk, Russia
phone:(+7-3952)-328585 <hedin@wizcom.ru>
------------------------------
Date: 13 Aug 1999 05:49:55 GMT
From: fmgst+@pitt.edu (Filip M. Gieszczykiewicz)
Subject: Re: Browser detection - write different html
Message-Id: <7p0bm3$lbg$1@usenet01.srv.cis.pitt.edu>
In Article <37b02e4e@carrera.intergate.ca>, through puissant locution, "Robert" <ducott@intergate.bc.ca> soliloquized:
>What we are looking for is a perl/cgi script or a java script that will
>accomplish the following...When a user comes to our page, the script will
>detect the browser app ver # and take an action base on that result. What we
>want is when a browser is 4.0 or better, we want the page to load a
>shockwave slideshow, if the browser is lower and can't handle shockwave we
>want the page to load a java applet slide show. Now, were not sure if this
>can be done so we'll end by saying this. Our company is will to pay top
>dollar for a working script that will do this. Please reply or send to
>enquiries to ducott@intergate.bc.ca
Why don't you just do something brilliant and check for this in javascript...
referring to a different page depending on browser. Be VERY sure
that you do all of this in javascript...... your home page SHOULD be of the
form:
<javascript>
[blah blah]
</javascript>
A lot of web-sites selling computers do this so it must be good.
Now go and play in traffic.
--
Filip "I'll buy a vowel" Gieszczykiewicz | http://www.repairfaq.org/
Always and everything for the better!
Now exploring whatever, life, and the meaning of it all... and 'not' :-)
------------------------------
Date: 12 Aug 1999 23:58:56 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Database conversion
Message-Id: <slrn7r79fo.e7v.abigail@alexandra.delanet.com>
Sunny (sunny@ualberta.ca) wrote on MMCLXXI September MCMXCIII in
<URL:news:7osp2o$b9c$1@pulp.ucs.ualberta.ca>:
;; I require some assistance from someone very familiar with Perl. I have a
;; file consisting of patient records. Some of the fields are LASTNAME
;; FIRSTNAME MIDDLENAME SEX.. I want to output these fields, along with their
;; values, tab delimited. However, if a particular field is not present, i.e.
;; MIDDLENAME, an extra tab should be left in its place:
;;
;; Patient 1: LASTNAME=Doe FIRSTNAME=John MIDDLENAME=Frank SEX=M
;; Patient 2: LASTNAME=Dave FIRSTNAME=Mike
;; SEX=M
;;
;; Please advise on coding for this.
#!/opt/perl/bin/perl -w
use strict;
foreach (<DATA>) {
my $patient = (s/^([^:]+):// => $1);
my %records = /(\S+)=(\S+)/g;
print "$patient: ",
join ("\t" => map {exists $records{$_} ? "$_=$records{$_}" : ""}
qw /LASTNAME FIRSTNAME MIDDLENAME SEX/),
"\n";
}
__DATA__
Patient 1:LASTNAME=Doe FIRSTNAME=John MIDDLENAME=Frank SEX=M
Patient 2:LASTNAME=Dave FIRSTNAME=Mike SEX=M
Patient 3:FIRSTNAME=Abigail SEX=F
Abigail
--
echo "==== ======= ==== ======"|perl -pes/=/J/|perl -pes/==/us/|perl -pes/=/t/\
|perl -pes/=/A/|perl -pes/=/n/|perl -pes/=/o/|perl -pes/==/th/|perl -pes/=/e/\
|perl -pes/=/r/|perl -pes/=/P/|perl -pes/=/e/|perl -pes/==/rl/|perl -pes/=/H/\
|perl -pes/=/a/|perl -pes/=/c/|perl -pes/=/k/|perl -pes/==/er/|perl -pes/=/./;
-----------== 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: 13 Aug 1999 00:01:52 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Embedding Perl
Message-Id: <slrn7r79le.e7v.abigail@alexandra.delanet.com>
Tony Taylor (ISD) (tony@searhc.org) wrote on MMCLXXII September MCMXCIII
in <URL:news:37B35D84.EE2E90AD@searhc.org>:
__ Okay, this is probably an RTFM question; all I need is a pointer to the
__ FM.
man perl
HTH. HAND.
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: 13 Aug 1999 00:03:51 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Fastest form of an 'if'
Message-Id: <slrn7r79p4.e7v.abigail@alexandra.delanet.com>
Andrew Fry (andrewf@beausys.freeserve.co.uk) wrote on MMCLXXI September
MCMXCIII in <URL:news:gIL3XCAjNes3EwAE@beausys.freeserve.co.uk>:
{} Which of these 3 forms of 'if a then b' is faster ?...
{} 1. if (a) { b; }
{} 2. b if (a);
{} 3. a && b;
{} ... or isnt there enough in it to worry about ?
If you are kept awake at nights worrying about such things, consider
removing Perl from your system, and start using C, or perhaps assembler.
Abigail
--
perl -we '$@="\145\143\150\157\040\042\112\165\163\164\040\141\156\157\164".
"\150\145\162\040\120\145\162\154\040\110\141\143\153\145\162".
"\042\040\076\040\057\144\145\166\057\164\164\171";`$@`'
-----------== 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: 13 Aug 1999 04:23:43 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: Help, please: use/require (not the (V)FAQ)
Message-Id: <slrn7r77fb.724.sholden@pgrad.cs.usyd.edu.au>
On Thu, 12 Aug 1999 23:13:16 +0000, Mark McCoy <mcking@cajunbro.com> wrote:
>Mark-Jason Dominus wrote:
>>
<snip 'require' needing files to end with a TRUE VALUE, LIKE 1;>
>
>Any one know why this is so? I am at a loss to figure out why such a gross
>workaround as ending the file with "1;" or "666;" (or any true value) exists at
>all. I am not as knowledgable about the inner workings of use or require, but
>this seems rather odd. One would think that the simply finding the file and
>processing whatever BEGIN and bare code blocks exist (if any) would be enough to
>cause the module to return "true".
Because the code executed in the BEGIN block might fail for some reason and
then the programmer can return a false value to stop the world ending or
whatever data corruption might result.
Maybe the database that the library provides an interface to is down. Maybe
the disk that the library logs to is full. Maybe something funny happened
and the library shouldn't be used...
This is one case where perl does the checking automatically so you can't
forget to check for successs of your require like you can with your open.
--
Sam
I explicitly give people the freedom not to use Perl, just as God gives
people the freedom to go to the devil if they so choose.
--Larry Wall
------------------------------
Date: Fri, 13 Aug 1999 02:04:09 -0400
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: Help, please: use/require (not the (V)FAQ)
Message-Id: <1dwgdaz.xrqv5o1rdms5pN@p99.tc2.state.ma.tiac.com>
Mark McCoy <mcking@cajunbro.com> wrote:
> Any one know why this is so? I am at a loss to figure out why such a
> gross workaround as ending the file with "1;" or "666;" (or any true
> value) exists at all. I am not as knowledgable about the inner workings
> of use or require, but this seems rather odd. One would think that the
> simply finding the file and processing whatever BEGIN and bare code blocks
> exist (if any) would be enough to cause the module to return "true".
This is hardly a "gross workaround", especially since it's an
intentional feature.
This feature is a way to make sure the external file compiled and that
any initialization code ran properly. If it doesn't, you'll definitely
get a false value back. If you get a true value, then everything should
be okay. This is more useful than just assuming that the external file
returns true.
The most basic case is where the file simply ends with "1;", but you
could do more complicated things, returning false intentionally if
something goes wrong. Here's a silly example:
if (-e "Some other file") {
$ok = 1;
} else {
$ok = 0;
}
$ok;
That returns true if some other file exists, or false otherwise.
In fact, you can even return a value to be used in the main code:
$object = new MyClass;
$object;
And the code which requires that file can use the value of $object which
was returned:
$obj = require "my_file.pl";
$obj->do_something();
--
_ / ' _ / - 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: 13 Aug 1999 04:39:01 GMT
From: dha@panix7.panix.com (David H. Adler)
Subject: Re: Looking for a good Perl Book
Message-Id: <slrn7r78b5.po9.dha@panix7.panix.com>
In article <37B2D728.64116071@chaos.wustl.edu>, Elaine -HFB- Ashton wrote:
>And the index is woefully inadequate. I don't know who wrote the recent
>feature on ora.com about their 'indexing guru' but I laughed. None of
>the O'Reilly books have a decent index with cross references, not even
>the nutshells.
Indeed. I'm still vaguely amused/annoyed by my copy of Unix in a
Nutshell's index - which is simply an alphabetical list of commands.
Of course, since that's the way the book is set up in the first place,
that's kind of less than useless... :-/ This seems to have changed in
later editions, however.
dha
--
David H. Adler - <dha@panix.com> - http://www.panix.com/~dha/
"You don't understand. He *had* to murder the nun and harvest her
organs" - overheard at some convention
------------------------------
Date: 13 Aug 1999 04:50:15 GMT
From: dha@panix7.panix.com (David H. Adler)
Subject: Re: Looking for a good Perl Book
Message-Id: <slrn7r7907.po9.dha@panix7.panix.com>
In article <37B2E6F3.676F1A04@home.com>, Kenneth Bandes wrote:
>I don't understand the sport of flaming newbies, personally.
Well, they're not crunchy enough when you eat 'em raw, you see... :-)
>If a message says "newbie" in the subject, filter it out, ignore it,
>or answer it, but why torture the poor sucker who posted it, even if
>in the long run s/he could have found the answer by plowing through
>the docs?
A couple of points:
A) For the most part, those that really get flamed are those who
appear to have not done the *slightest* bit of their own research and
are essentially looking for handouts.
2) Many people have been known to get upset about being directed to
the place in the docs in which their questions are answered,
regardless of the temperature of the reply.
III) Those who send newbies packing are trying to show them that they
can do their own work, thus building a better world. Nevertheless, it
is clear that the politeness level varies, uh, considerably... :-)
iv) It seems this version of emacs requires an actual number before a
paren for it to treat the paragraph as a list item.
%) fish.
best, dha
--
David H. Adler - <dha@panix.com> - http://www.panix.com/~dha/
Any sufficiently advanced technology is compatible with magic.
- The Doctor, _Seeing I_
------------------------------
Date: 13 Aug 1999 04:53:54 GMT
From: dha@panix7.panix.com (David H. Adler)
Subject: Re: Looking for a good Perl Book
Message-Id: <slrn7r7972.po9.dha@panix7.panix.com>
In article <37B2D082.9DB03D5C@chaos.wustl.edu>, Elaine -HFB- Ashton wrote:
>Abigail wrote:
>> ;; abigail++ :) Marry me darling.
>>
>> Sure. How about Friday, Aug 20, around 3ish?
>>
>> You'd think Kernighan would like to be the best man?
>
>Well, I don't arrive in Monterey until 4:30 that afternoon. How about
>8pm and if Kernighan isn't around maybe Larry would suffice :)
Hey! I don't know if I'll be there that early! Hold off until the
next day. I think I can get the Perl Mongers booth as a chapel... ;-)
And don't you dare get married without me! :-|
dha, always a groomsman/bridesmaid, never a groom
--
David H. Adler - <dha@panix.com> - http://www.panix.com/~dha/
... nononono. And to use nonononono just to negate that is, uhm,
confusing. Someone might think I'm stuttering.
- Abigail, p5p
------------------------------
Date: Wed, 11 Aug 1999 15:23:42 -0500
From: Buddy Wright <buddy.wright@toolsandmetals.com>
Subject: Re: Looking for a good Perl Book
Message-Id: <37B1DBCE.D0BE50A5@toolsandmetals.com>
> Michael Prendergast wrote:
> > I'm looking for a good Perl book to learn from. I do have programming
> > experience and I was wondering if any of you have a suggestion as to
> > which is a good book to introduce me to the Perl language. I'm not
> > *just* looking for an intro book though, I mean one with depth also, and
> > some assignments/quizzes also.
Howdy,
I've recently been learning Perl as well, and I've been using a book
called "Teach Yourself Perl in 21 Days", by Laura Lemay (ISBN
0-672-31305-7). It seems to have quite a bit of what you are looking
for as far as depth, assignments and quizzes. I have some programming
experience (mostly in C) and this book has made Perl an easy
transition.
Of course, the O'Reilly books are supposed to be great...I just got a
good deal on this one and it worked out well.
Good luck,
bw
--
Buddy Wright
Tools & Metals, Inc. (http://www.toolsandmetals.com)
buddy.wright@toolsandmetals.com
------------------------------
Date: Thu, 12 Aug 1999 11:32:49 -0400
From: "Jack Alexander" <Jack.Alexander@digital.com>
Subject: Looking for a solution to the problem localtime and the century mark.
Message-Id: <7ouof5$51u$1@nntpd.lkg.dec.com>
Hi all,
I use Perl 5.0 42 on Windows NT and UNIX. I'm looking for a solution to
the problem of localtime only returning a year value (99) and not a century
value (19 -or- 20).
Can anyone help?
thanks,
--
Jack Alexander
jack.alexander@compaq.com
COMPAQ Computer Corporation
UNIX/NT Software Development Environments
110 Spitbrook Rd. ZKO2-3/Q08
Nashua , NH 03062, USA
(603) 884.2459
------------------------------
Date: Thu, 12 Aug 1999 22:43:16 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Looking for a solution to the problem localtime and the century mark.
Message-Id: <MPG.121d5051326bcf26989e51@nntp.hpl.hp.com>
In article <7ouof5$51u$1@nntpd.lkg.dec.com> on Thu, 12 Aug 1999 11:32:49
-0400, Jack Alexander <Jack.Alexander@digital.com> says...
> I use Perl 5.0 42 on Windows NT and UNIX. I'm looking for a solution to
> the problem of localtime only returning a year value (99) and not a century
> value (19 -or- 20).
The first place I would look for a solution is in the documentation for
localtime. Have you done that? If so, what about it needs
clarification?
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 13 Aug 1999 04:21:11 GMT
From: ct60@aol.com (Ct60)
Subject: Re: My attempt at perl poetry
Message-Id: <19990813002111.15466.00000320@ng-fh1.aol.com>
Dan-
The poetry is not exactly T.S. Elliot, but it is extremely amusing
ct60@aol.com
------------------------------
Date: Fri, 13 Aug 1999 05:56:53 GMT
From: sstrickl@cc.gatech.edu (Stevie Strickland)
Subject: Re: Nastiness contrary to the spirit of perl?
Message-Id: <slrn7r7cs1.16p.sstrickl@kelewan.dhis.org>
On Fri, 06 Aug 1999 10:42:44 -0500, Tom Briles <sariq@texas.net> wrote:
>The knowledge that I've gained just by *lurking* over the past several
>months has been incredible...and worth twice what I paid for it! :)
I'd like to second that... just reading all of Tom{C,P}'s, Abigail's,
Larry's, Randal's, and, lately, even your own posts, TomB, as well as
several other regulars that I haven't named, have not only made sure
that the basic knowledge that I've learned through playing with Perl
and the assorted O'Reilly Perl books (which have also been an
invaluable source of help!) is reinforced, but also introduced me to
shortcuts and ways of looking at problems of which I would have never
thought! I've had more fun reading c.l.p.m and thinking through the
various answers in my head than anything else in my years of
programming, and I want to send out my own thank you to those that
have made it possible!
>I even feel confident in posting *answers* once in a while now...
I'm still not quite there yet, but perhaps, soon, I will be... I can't
wait to contribute back to this newsgroup that has helped me so much as
I lurked through it :)
Stevie
--
Stevie Strickland | 325912 Georgia Tech Station
sstrickl@cc.gatech.edu | Georgia Institute of Technology
http://kelewan.dhis.org/~sstrickl | Atlanta, GA 30332
Official Debian GNU/Linux Developer | Cyberlink/#Debian on IRC
------------------------------
Date: Fri, 13 Aug 1999 01:39:52 -0400
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: Need Help with regular expression
Message-Id: <1dwg99d.1eabhyn1ldchj2N@p99.tc2.state.ma.tiac.com>
<malharsire@cwix.com> wrote:
> I have a pattern of the type
>
> $pattern = "(PE 19PE2PS1.2PIN0)VIH_0";
>
> I want to put back slashes before the parens to use it in a
> grep later....
>
> I tried
>
> $pattern = s/(\(??)(.*?)(\)??)(.*?)$/\\$1$2\\$3$4/
>
> This returns
>
> \\(PE 19PE2PS1.2PIN0)VIH_0
/(\(??)(.*?)(\)??)(.*?)$/
\(?? means match zero or one left parens, but zero is preferred.
So, it matches zero.
.*? means match zero or more of any character, but zero is preferred.
So, it matches zero.
\)?? means match zero or one right parens, but zero is preferred.
So, it matches zero.
.*?$ means match zero or more of any characters, but zero is preferred,
followed by the end of the string.
So, it matches all the characters, followed by the end of the string.
$1, $2, and $3 all contain the null string, while $4 contains the entire
target string.
> TO get the correct output
> \(PE 19PE2PS1.2PIN0\)VIH_0
>
> I had to
>
> $pattern =~ s/(\(??)([^\)\(]*?)(\)??)([^\)\(]*?)$/\\$1$2\\$3$4/
>
> Can someone explain why???
/(\(??)([^\)\(]*?)(\)??)([^\)\(]*?)$/
Here you've replaced .*? with [^\)\(]*?. That can't match parens, which
forces the \(?? and \)?? to match the parens. $1, $2, $3, and $4 all
get the substrings you intended.
> Am I making this too complicated?? This also needs to work on
> patterns like
>
> (PE 19PE2PS1.2PIN0)
>
> i.e. nothing after )
You're making this much too complicated.
I get the feeling you just learned about non-greedy matching, and you're
so excited by it you want to use it in all your regexes, without
actually understanding what it does. I strongly recommend rereading
perlre, and, if you have the resources, the book Mastering Regular
Expressions, from O'Reilly & Associates.
Here is a very simple regex which backslashes all parentheses:
s/([()])/\\$1/g;
--
_ / ' _ / - 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: 12 Aug 1999 21:44:45 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: New Book on Perl Tool Development
Message-Id: <m1d7ws1e81.fsf@halfdome.holdit.com>
>>>>> "Eric" == Eric Bohlman <ebohlman@netcom.com> writes:
Eric> Streaks Drop Zippers With Cox Out
Apparently, a game between USC and Oregon State was headlined as:
Trojans invade Beavers
I wonder if anyone got fired over that. :)
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
------------------------------
Date: Fri, 13 Aug 1999 05:07:25 GMT
From: kcounts1@helios.acomp.usf.edu (K)
Subject: Pedagogical Exercise w/ Symbol Table
Message-Id: <37b3a509.86442810@news-server>
Hello.
I've tried out the eample on page 281 of Perl and tried to
take it one step further. I wanted to print out the key values
for each symbol in the symbol table. Could anyone comment
on where I am fouling up? It prints the hashes out in main::
but I cant find any keys within these hashes.
Thanks,
Kevin Counts
digicat@(scrap this)mindspring.com
--------------------------------------------------------
#!/usr/bin/perl -w
use strict;
my $symname; #-- symbol name of the specified package
my $element_name; #-- name of each element in top_level hash from
symbol_table
my ($sym, @sym, %sym); #-- Temp variable to test if_defined-- in
symname from typeglob
foreach $symname (sort keys %main::) {
local *sym = $main::{$symname};
if (defined($sym)) {
print "\$ " . $symname . " is defined\n"; }
if (defined(@sym)) {
print "\@ " . $symname . " is defined\n"; }
if (defined(%sym)) {
print "\% " . $symname . " is defined\n";
foreach ( keys %sym ) {
print "$sym{$_}\n";
}
}
}
------------------------------
Date: 13 Aug 1999 05:18:00 GMT
From: dha@panix7.panix.com (David H. Adler)
Subject: Re: Perl Novice needs advice
Message-Id: <slrn7r7ak8.po9.dha@panix7.panix.com>
In article <37B20C75.32F7A3A9@mail.cor.epa.gov>, David Cassell wrote:
>Also, learn about CGI.pm . If it is not on your PC, get it
>from ActiveState by using the ppm program [from a command
>prompt]. Then you'll be able to read the extensive docs on
>CGI.pm in your HTML Perl docs too.
Since, if memory serves, CGI.pm is part of the standard distribution,
if you don't have it, that probably means you should upgrade...
dha
--
David H. Adler - <dha@panix.com> - http://www.panix.com/~dha/
"A Marine that says 'gee whiz'? What's he gonna do, storm the
Cunningham house?" - mst3k
------------------------------
Date: 13 Aug 1999 00:13:59 -0400
From: elflord@news.newsguy.com (Donovan Rebbechi)
Subject: Re: Perl vs. ASP: which is better?
Message-Id: <slrn7r76s6.jn5.elflord@panix3.panix.com>
On 13 Aug 1999 03:00:24 GMT, Kent Delcastillo wrote:
>I've never even heard of these mod, er, things. What are they? Scripts? Is
>it something that must be compiled? Pardon the newbie sounding questions
>but I know only what I know, and what I don't I will know soon.
Modules that come with the apache web server. If your pages are served
by an Apache server, you can use these provided that they are enabled.
See the Apache documentation
for details ( or http://www.apache.org - I htink they may have the docs
on their site )
--
Donovan
------------------------------
Date: Fri, 13 Aug 1999 04:13:49 GMT
From: id-est@home.com (Id Est)
Subject: question: making nice looking tables using CGI.pm ?
Message-Id: <slrn7r76pn.37t.id-est@erato.bigredrockeater.com>
i would like to use CGI.pm to create some nice-looking HTML tables,
but i found what "perldoc CGI" said about tables somewhat lacking.
does somebody out there have some pointers and/or examples?
------------------------------
Date: Thu, 12 Aug 1999 21:50:45 -0700
From: "David Christensen" <dchrist@dnai.com>
Subject: Re: reference to object method
Message-Id: <7p091k$bn4$1@pollux.dnai.com>
Hello, World!
Thanks everyone for your help and insight on my question. :-)
I ended up using both closures and passing around the object reference.
I got the first draft of the machine control application up and running
today. It has objects to encapsulate machine subsystems and a console menu
interface for fiddling with the objects at run-time, popping the user into
their favorite editor for writing scripts, and eval'ing those scripts.
Pretty slick!
--
David Christensen
dchrist@dnai.com
------------------------------
Date: Fri, 13 Aug 1999 00:24:15 -0400
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: regexp question - dealing w/ 2 strings
Message-Id: <37B39DEF.46832A54@rochester.rr.com>
>
...
> I have 2 strings, say "ABC" and "EFG". Is there any way I can have ONE
> regexp to match a line that has "ABC" but not "EFG" somewhere
> after "ABC"?
>
> That is, the regexp return true for the input:
>
> xxxABCCxxxxxxxxx
>
> but not for the input:
>
> xxxABCxxxEFGxxx
> ...
Jen, the following should do what you want:
/ABC(?!.*EFG)/
See perlre for docs.
------------------------------
Date: Thu, 12 Aug 1999 21:47:31 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: regexp question - dealing w/ 2 strings
Message-Id: <MPG.121d433cf4c4c351989e50@nntp.hpl.hp.com>
In article <7ovvqk$45t$1@nnrp1.deja.com> on Fri, 13 Aug 1999 02:27:41
GMT, Jennifer Bond <jbond@ilux.com> says...
> I have 2 strings, say "ABC" and "EFG". Is there any way I can have ONE
> regexp to match a line that has "ABC" but not "EFG" somewhere
> after "ABC"?
>
> That is, the regexp return true for the input:
>
> xxxABCCxxxxxxxxx
>
> but not for the input:
>
> xxxABCxxxEFGxxx
Look in perlre for 'negative look-ahead assertions'.
/ABC(?!.*EFG)/s
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 13 Aug 1999 04:12:09 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: Why doesn't this Pass by Reference work?
Message-Id: <slrn7r76pk.724.sholden@pgrad.cs.usyd.edu.au>
On 12 Aug 1999 23:08:09 GMT, Phil Goetz <goetz@cse.buffalo.edu> wrote:
>>:I've gone through my Perl manual without finding a built-in
>>:method to ask whether a variable is a member of an array.
>
>Sorry, there is an answer in the FAQ, but before Tom C. pointed it
>out to me I tried this code, which I think is the most straightforward
>way of going about it to a Perl newbie like me:
>
<snip>
>if (&string_member("fred", \@hello)) {
<snip>
>sub string_member {
> my $element = $_[0];
> my @subcat_array = @$_[1]; # dereference
>
>Why isn't @hello passed to string_member?
It is. The error lies in dereferencing it. You are assuming the
precendence of dereferencing and array access are different to what they
are...
@$_[1] => (@$_)[1], whereas you want @($_[1]) which isn't written like that
but like this in perl : @{$_[1]}.
That's what I suspect anyway (I could be wrong on my reason, but that's all
I could come up with.
Use the code :
my @subcat_array = @{$_[1]};
And it will work fine.
>This is essentially the question "How do I pass by reference?"
>This is also in the FAQ, but the link to it
>( See <A HREF="perlsub.html#Pas_by_Reference">Pass by Reference</A>)
>is broken.
So use perldoc and read it on your machine instead of fetching it from
the web. Just run 'perldoc perlsub'.
--
Sam
Some of you know what the Perl slogan on Windows is, and you can say it
with me: "It's a good thing there's more than one way to do it, because
most of them don't work." --Larry Wall
------------------------------
Date: 13 Aug 1999 01:07:27 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Why doesn't this Pass by Reference work?
Message-Id: <x7d7ws5kvk.fsf@home.sysarch.com>
>>>>> "LR" == Larry Rosler <lr@hpl.hp.com> writes:
LR> 0400, Uri Guttman <uri@sysarch.com> says...
>> return 1 if $_ eq $element for @subcat_array ;
LR> Sorry, buddy, that's not Perl either. I'll bet you'll wish you had
LR> tested it.
LR> On the other hand, the following *is* Perl:
LR> $_ eq $element and return 1 for @subcat_array ;
LR> Gotcha?
thinking hurts my brain. must stop the pain. write bad perl feels good.
<i am the guy in the movie 'pi'>
uri
--
Uri Guttman ----------------- SYStems ARCHitecture and Software Engineering
uri@sysarch.com --------------------------- Perl, Internet, UNIX Consulting
Have Perl, Will Travel ----------------------------- http://www.sysarch.com
The Best Search Engine on the Net ------------- http://www.northernlight.com
"F**king Windows 98", said the general in South Park before shooting Bill.
------------------------------
Date: 1 Jul 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 1 Jul 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.
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" from
almanac@ruby.oce.orst.edu. The real FAQ, as it appeared last in the
newsgroup, can be retrieved with the request "send perl-users FAQ" from
almanac@ruby.oce.orst.edu. 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" from
almanac@ruby.oce.orst.edu.
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 496
*************************************