[9593] in Perl-Users-Digest
Perl-Users Digest, Issue: 3187 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jul 17 14:18:18 1998
Date: Fri, 17 Jul 98 11:03:50 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Fri, 17 Jul 1998 Volume: 8 Number: 3187
Today's topics:
Adabas and Perl: select into <schalow@fh-worms.de>
Re: clp.moderated (Abigail)
Re: Coding Quiz (was Re: efficiency: print<<"xxx" vs. p <jdporter@min.net>
Re: Coding Quiz (was Re: efficiency: print<<"xxx" vs. p <boys@aspentech.com>
Re: efficiency: print<<"xxx" vs. print (Matt Knecht)
expressions <gcushing@exchange.nih.gov>
Re: expressions (Larry Rosler)
Get char from string <bchapman@best.com>
Help me on the if-then-else branch (lloyd)
Re: Help me on the if-then-else branch <pearse@mail.shebang.net>
Re: Help me on the if-then-else branch (M.J.T. Guy)
Re: Help me on the if-then-else branch (Bob Trieger)
Re: Help me on the if-then-else branch (Craig Berry)
Re: Help me on the if-then-else branch <markstang@ncgroup.com>
Re: Help me on the if-then-else branch <joneil@cks.ssd.k12.wa.us>
How do I clear an array? <pearse@mail.shebang.net>
Re: How do I clear an array? (Larry Rosler)
Re: How do I clear an array? (Craig Berry)
Re: How do I clear an array? (Bob Trieger)
Re: How do I clear an array? <pearse@mail.shebang.net>
Re: How do I clear an array? <pearse@mail.shebang.net>
Re: How do I clear an array? (Josh Kortbein)
Re: How to interprete What Sucks/Rules? (Chris Nandor)
Re: How to interprete What Sucks/Rules? lusol@turkey.cc.Lehigh.EDU
Re: How to interprete What Sucks/Rules? (Larry Rosler)
Re: How to interprete What Sucks/Rules? (Josh Kortbein)
Re: Lex for Perl / Object Dumper? (Andrew M. Langmead)
Re: MIME types <dparrott@ford.com>
module forcing a reload of itself (a mod_perl question) <*@qz.to>
Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 17 Jul 1998 18:07:55 +0200
From: Oliver Schalow <schalow@fh-worms.de>
Subject: Adabas and Perl: select into
Message-Id: <35AF76DB.61CBCE83@fh-worms.de>
The Adabas Perl Interface:
How can I use the SELECT INTO statement and DB-Procedures in Perl?
The problem is: My scalar variables in Perl are unchanged after the
SQL-statement!
In the manual, it says that
Adabas::sql ($cursor,"SELECT DATE, TIME INTO :resDate, :resTime FROM
dual");
would work.
I can only get values with Adabas::fetch and Adabas::fetchHash, that
works fine
(I use Adabas 10.0, Perl 5.00404, SuSE Linux 5.2).
I guess the answer must be simple. Did anybody have the same problem?
Please give me a short example. Thank you.
My Perl sourcecode:
...
my $x='';
&Adabas::sql($cursor, <<"EndOfSQL") and &sqlerr;
SELECT name INTO :x FROM people where name='abcdef'
EndOfSQL
print "Value of x: $x\n";
&Adabas::sql($cursor, <<"EndOfSQL") and &sqlerr;
DBPROCEDURE abc.testproz('hello',:x)
EndOfSQL
print "Value of x: $x\n";
...
------------------------------
Date: 17 Jul 1998 17:07:53 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: clp.moderated
Message-Id: <6oo0d9$5hl$1@client3.news.psi.net>
Russ Allbery (rra@stanford.edu) wrote on MDCCLXXXI September MCMXCIII in
<URL: news:m3zpe9ndg6.fsf@windlord.Stanford.EDU>:
++ Abigail <abigail@fnx.com> writes:
++
++ > He doesn't respond [1]. Now what do I do?
++
++ > [1] PSInet. Worthless provider. Given the number of new groups that
++ > appeared on their servers the last year, I never had any hopes
++ > comp.lang.perl.moderated will be a group I can read.
++
++ Find a different provider? Newsguy is extremely inexpensive for a fairly
++ solid newsfeed.
I don't think management will go for that..... PSI salestalks make PHB's drool.
Abigail
--
perl5.004 -wMMath::BigInt -e'$^V=new Math::BigInt+qq;$^F$^W783$[$%9889$^F47$|88768$^W596577669$%$^W5$^F3364$[$^W$^F$|838747$[8889739$%$|$^F673$%$^W98$^F76777$=56;;$^U=substr($]=>$|=>5)*(q.25..($^W=@^V))=>do{print+chr$^V%$^U;$^V/=$^U}while$^V!=$^W'
------------------------------
Date: Fri, 17 Jul 1998 16:15:06 GMT
From: John Porter <jdporter@min.net>
Subject: Re: Coding Quiz (was Re: efficiency: print<<"xxx" vs. print)
Message-Id: <35AF7A21.518C@min.net>
Uri Guttman wrote:
>
> this quiz has 3 main questions and a bonus one. all are about coding
> i have given this quiz to many computer people, and only a handful have
> ever gotten 3 points.
Yes, some of us have seen this thing before.
This quiz -- or rather, Uri's answers to it -- are naturally the
reflection of one man's philosophy. And this man is not interested
in philosophical debates; those who happen to disagree -- no matter
how smart, nor how wise -- can go to hell, it seems.
--
John Porter
sub Another::Just {
shift;local$\=",\n";local$,=' ';
print reverse @_,(caller(0))[3]=~/(.*)::(.*)/;
}
sub Hacker::Perl{(caller(0))[3]=~/(.*)::(.*)/}
Just Another Perl Hacker;
------------------------------
Date: Fri, 17 Jul 1998 18:19:35 +0100
From: Ian Boys <boys@aspentech.com>
Subject: Re: Coding Quiz (was Re: efficiency: print<<"xxx" vs. print)
Message-Id: <35AF87A7.6EEA@aspentech.com>
Uri Guttman wrote:
>
>
> 1. Who is main the PERSON you should think about while you are
> writing code?
The person who will maintain it after you are gone.
>
> 2. Other than comments, what is the most important HUMAN aspect of
> code?
Transparency of function.
>
> 3. What is the main PURPOSE of comments?
To explain _why_ the code does what it does.
>
> Bonus: What is the OPPOSITE of spaghetti code?
>
Lasagne code (neatly ordered layers of functionality).
Ian
------------------------------
Date: Fri, 17 Jul 1998 16:09:09 GMT
From: hex@voicenet.com (Matt Knecht)
Subject: Re: efficiency: print<<"xxx" vs. print
Message-Id: <FGKr1.144471$on1.7747285@news2.voicenet.com>
Tom Christiansen <tchrist@mox.perl.com> wrote:
>In comp.lang.perl.misc, lr@hpl.hp.com (Larry Rosler) writes:
>:Real Programmers don't write comments! Seriously, comments should deal
>:with higher-level function, not with implementation details, which should
>:speak for themselves (assuming the reader knows the language).
>
>Why is it that so few programmers ever figure this out? Even the
>millionth time you see an "add one to i" comment, it doesn't help.
>
>--tom
>
> Basically, avoid comments. If your code needs a comment to be
> understood, it would be better to rewrite it so it's easier to
> understand. --Rob Pike
In my experience, it's been that few programmers ever comment, not the
inverse.
I don't comment for the code I'm writing, I comment for the logic I'm
using. Even if nobody ever sees it except me, it can be a useful map to
follow a program by. This is especially true when you get deeply
nested, and are dealing with many variables or states.
They are also useful to explain why a particular contstruct was chosen. I
often quantify something with:
# X would be a good deal faster if it was Y, but not nearly as
# bullet-proof.
All this and the fact that my employers love comments works for me
(Although, I think we can all safely say: '$i++; # increment $i' is a
pointless waste of time).
--
Matt Knecht - <hex@voicenet.com>
"496620796F752063616E207265616420746869732C20796F7520686176652066
617220746F6F206D7563682074696D65206F6E20796F75722068616E6473210F"
------------------------------
Date: Fri, 17 Jul 1998 11:58:58 -0400
From: George Cushing <gcushing@exchange.nih.gov>
Subject: expressions
Message-Id: <35AF74C2.3E6AE057@exchange.nih.gov>
I am reading a log as input and wants to scan every line to pick up
fields. My fifth field is not scanning right (request). Here is my
script:
#!/usr/bin/perl
$logfl = "Jun.log.newfmt";
open(IN,$logfl);
while (<IN>) {
($annr, $rfc931, $authuser, $timestamp, $request, $status, $bytes) =
/^(\S+) (\S+) (\S+) \[(.+)\] \"(.+)\" (\S+) (\S+)\s/;
$cnt = $cnt +1;
if ($cnt < 5) {
print "annr =$annr\n";
print "rfc931 =$rfc931\n";
print "authuser =$authuser\n";
print "timestamp=$timestamp\n";
print "request =$request\n";
print "status =$status\n";
print "bytes =$bytes\n";
}
}
Here is my output:
annr =165.112.136.45
rfc931 =-
authuser =-
timestamp=19/Jun/1998:18:27:15 -0400
request =GET /images/employee.jpg HTTP/1.0" 200 2097
"http://eos16.dcrt.nih.go)
status =GET
bytes =/images/employee.jpg
MY QUESTION IS WHY THE SCAN FOR request field DIDNOT WORK?
\"(.+)\" should have scaned for the 2th quotes but it went to the last
quote of the line.
Did I have the wront expression? There was a quote before GET. (That
was the fist quote). I need up here! Am I not understanding the
expression for the request first?
Any help will be appreciated. Thanks.
George
gcushing@exchange.nih.gov
------------------------------
Date: Fri, 17 Jul 1998 09:42:32 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: expressions
Message-Id: <MPG.10191ed345c8d1d398971c@nntp.hpl.hp.com>
[This followup was posted to comp.lang.perl.misc and a copy was sent to
the cited author.]
In article <35AF74C2.3E6AE057@exchange.nih.gov> on Fri, 17 Jul 1998
11:58:58 -0400, George Cushing <gcushing@exchange.nih.gov> says...
...
> \"(.+)\" should have scaned for the 2th quotes but it went to the last
> quote of the line.
> Did I have the wront expression? There was a quote before GET. (That
> was the fist quote). I need up here! Am I not understanding the
> expression for the request first?
It is doing that because of the "greedy" nature of the quantifiers + and
*. The regex tries to eat up as many characters as possible before
finding a double-quote. What you want is either a "non-greedy"
quantifier:
"(.+?)"
or (faster and better), tell it explicitly what not to accept:
"([^"])"
You don't need to escape the double-quotes; they are not
regex metacharacters.
--
Larry Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Fri, 17 Jul 1998 10:36:59 -0700
From: bchapman <bchapman@best.com>
Subject: Get char from string
Message-Id: <35AF8BBB.EF03907A@best.com>
Say I have a string that is 10 chars long and I want the 4th char of it.
The only way I know how to do that is substr the string down to a 1
character string, and then chop that to give me the char.
Is there an easier way to do that?
My return address works. Please cc it.
Bill Chapman
------------------------------
Date: 17 Jul 1998 16:20:23 GMT
From: lloyd007@best.com (lloyd)
Subject: Help me on the if-then-else branch
Message-Id: <lloyd007-1707980934570001@lloyd007.vip.best.com>
I am a total newcomer to the perl language. I bought the book Learning
Perl and I have learned a lot already, but there is a small 9 line program
that I cannot figure out.
Here is the program:
#!/usr/local/bin/perl -w
print "What is your name?\n";
$name = <STDIN>;
if ($name eq "lloyd") {
print "Hi Lloyd glad to see you back!\n";
} else {
print "hello, $name\n";
}
I get a prompt asking me for my name, and it accepts my input, However
when I put the word Lloyd in, it ignores the if then branch and goes
straight to the last line and prints hello lloyd.
Why is this happening. I copied this program stright out of that book and
it doesn't work. Someone please be kind enough to help.....
lloyd francis
lloyd007@best.com
------------------------------
Date: Fri, 17 Jul 1998 16:36:56 +0000
From: Robert Eric Pearse <pearse@mail.shebang.net>
Subject: Re: Help me on the if-then-else branch
Message-Id: <35AF7DA8.87FB3BBB@mail.shebang.net>
lloyd wrote:
>
> I am a total newcomer to the perl language. I bought the book Learning
> Perl and I have learned a lot already, but there is a small 9 line program
> that I cannot figure out.
>
> Here is the program:
>
> #!/usr/local/bin/perl -w
>
> print "What is your name?\n";
> $name = <STDIN>;
> if ($name eq "lloyd") {
> print "Hi Lloyd glad to see you back!\n";
> } else {
> print "hello, $name\n";
> }
>
> I get a prompt asking me for my name, and it accepts my input, However
> when I put the word Lloyd in, it ignores the if then branch and goes
> straight to the last line and prints hello lloyd.
>
> Why is this happening. I copied this program stright out of that book and
> it doesn't work. Someone please be kind enough to help.....
>
> lloyd francis
> lloyd007@best.com
After '$name=<STDIN>;', insert 'chomp($name);'
Gotta lose the end of line character.
Cheers,
Robert
--
Robert Eric Pearse
pearse@mail.shebang.net
"There's a monkey in my pants. . .and I like it."
------------------------------
Date: 17 Jul 1998 16:48:41 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Help me on the if-then-else branch
Message-Id: <6onv99$r75$1@pegasus.csx.cam.ac.uk>
In article <lloyd007-1707980934570001@lloyd007.vip.best.com>,
lloyd <lloyd007@best.com> wrote:
>I am a total newcomer to the perl language. I bought the book Learning
>Perl and I have learned a lot already, but there is a small 9 line program
>that I cannot figure out.
>
>Here is the program:
>
>#!/usr/local/bin/perl -w
>
>print "What is your name?\n";
>$name = <STDIN>;
>if ($name eq "lloyd") {
> print "Hi Lloyd glad to see you back!\n";
>} else {
>print "hello, $name\n";
>}
>
>I get a prompt asking me for my name, and it accepts my input, However
>when I put the word Lloyd in, it ignores the if then branch and goes
>straight to the last line and prints hello lloyd.
You forgot about teh newline at the end of the line of input.
$name will have the value "lloyd\n". So you need to put a
chomp($name);
See perldoc -f chomp.
Mike Guy
------------------------------
Date: Fri, 17 Jul 1998 16:47:29 GMT
From: sowmaster@juicepigs.com (Bob Trieger)
Subject: Re: Help me on the if-then-else branch
Message-Id: <6onvbi$vho$2@strato.ultra.net>
[ posted and mailed ]
lloyd007@best.com (lloyd) wrote:
->
-> #!/usr/local/bin/perl -w
->
-> print "What is your name?\n";
-> $name = <STDIN>;
at this point `$name' contains whatever you typed and the a newline character
from pressing enter. You have to use `chomp' or `chop' to remove the last
character.
-> if ($name eq "lloyd") {
-> print "Hi Lloyd glad to see you back!\n";
-> } else {
-> print "hello, $name\n";
-> }
->
-> I get a prompt asking me for my name, and it accepts my input, However
-> when I put the word Lloyd in, it ignores the if then branch and goes
-> straight to the last line and prints hello lloyd.
it is not ignoring you. It is doing exactly as you told it to. It sees
`lloyd\n' not `lloyd'.
-> Why is this happening. I copied this program stright out of that book and
-> it doesn't work. Someone please be kind enough to help.....
Are you sure that you didn't miss a line?
Good luck
Bob Trieger
sowmaster@juicepigs.com
" Cost a spammer some cash: Call 1-800-400-1972
Ext: 1949 and let the jerk that answers know
that his toll free number was sent as spam. "
------------------------------
Date: 17 Jul 1998 16:53:34 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Help me on the if-then-else branch
Message-Id: <6onvie$7tr$2@marina.cinenet.net>
lloyd (lloyd007@best.com) wrote:
: I am a total newcomer to the perl language. I bought the book Learning
: Perl and I have learned a lot already, but there is a small 9 line program
: that I cannot figure out.
:
: Here is the program:
[snip]
: if ($name eq "lloyd") {
[snip]
:
: I get a prompt asking me for my name, and it accepts my input, However
: when I put the word Lloyd in, it ignores the if then branch and goes
: straight to the last line and prints hello lloyd.
Your test is for 'lloyd' with all lower case, but (based on what you say
above) what you enter is 'Lloyd' with an initial capital. Those aren't
the same string, so naturally the string equality test fails. Try typing
in 'lloyd' at the prompt and it should work.
If you want to do a case-insensitive equality check, probably the easiest
way is to replace your line above with
if (lc $name eq "lloyd") {
Hope this helps!
---------------------------------------------------------------------
| 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: Fri, 17 Jul 1998 13:30:59 -0400
From: "Mark Stang" <markstang@ncgroup.com>
Subject: Re: Help me on the if-then-else branch
Message-Id: <6oo1or$ku8$1@usenet1.interramp.com>
I'm a newbie too, but I think your code should be changed to read
$name = chomp(<STDIN>);
lloyd wrote in message ...
>I am a total newcomer to the perl language. I bought the book Learning
>Perl and I have learned a lot already, but there is a small 9 line program
>that I cannot figure out.
>
>Here is the program:
>
>#!/usr/local/bin/perl -w
>
>print "What is your name?\n";
>$name = <STDIN>;
>if ($name eq "lloyd") {
> print "Hi Lloyd glad to see you back!\n";
>} else {
>print "hello, $name\n";
>}
>
>I get a prompt asking me for my name, and it accepts my input, However
>when I put the word Lloyd in, it ignores the if then branch and goes
>straight to the last line and prints hello lloyd.
>
>Why is this happening. I copied this program stright out of that book and
>it doesn't work. Someone please be kind enough to help.....
>
>lloyd francis
>lloyd007@best.com
------------------------------
Date: Fri, 17 Jul 1998 10:46:43 -0700
From: Jerome O'Neil <joneil@cks.ssd.k12.wa.us>
To: lloyd <lloyd007@best.com>
Subject: Re: Help me on the if-then-else branch
Message-Id: <35AF8E03.FDDC34CE@cks.ssd.k12.wa.us>
lloyd wrote:
> #!/usr/local/bin/perl -w
>
> print "What is your name?\n";
> $name = <STDIN>;
> if ($name eq "lloyd") {
> print "Hi Lloyd glad to see you back!\n";
> } else {
> print "hello, $name\n";
> }
>
> I get a prompt asking me for my name, and it accepts my input, However
> when I put the word Lloyd in, it ignores the if then branch and goes
> straight to the last line and prints hello lloyd.
Two things come to mind, bolth untested. One would be that $name ==
lloyd\n. Try
$name = <STDIN>;
chomp $name;
to remove any CR/LF at the end of $name.
The other is that it is missing due to case sensitivity.
Jerome
------------------------------
Date: Fri, 17 Jul 1998 16:31:46 +0000
From: Robert Eric Pearse <pearse@mail.shebang.net>
Subject: How do I clear an array?
Message-Id: <35AF7C72.32ECB48E@mail.shebang.net>
Hey,
I've got all sorts of blocks within blocks. Inside one of the blocks I
create an array of dir contents. Well, on the second go around, the
array is simply appended with the contents of the second dir.
And when I try to use the array my script dies because it references an
array member from the wrong dir. (Well, it *really* dies because I told
it to. Symantics, ain't they crazy. . .) Simple solution without
rewriting code: clear the array.
But, ' @array = ""; ' inserts a null value into the array. And when it
accesses the null value in a dir, it barfs like my high school prom date
after two Boones (Strawberry Hill, no less).
Cheers,
Robert
--
Robert Eric Pearse
pearse@mail.shebang.net
"There's a monkey in my pants. . .and I like it."
------------------------------
Date: Fri, 17 Jul 1998 10:06:14 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: How do I clear an array?
Message-Id: <MPG.10192464a26494aa98971d@nntp.hpl.hp.com>
In article <35AF7C72.32ECB48E@mail.shebang.net> on Fri, 17 Jul 1998
16:31:46 +0000, Robert Eric Pearse <pearse@mail.shebang.net> says...
...
> But, ' @array = ""; ' inserts a null value into the array. And when it
> accesses the null value in a dir, it barfs like my high school prom date
> after two Boones (Strawberry Hill, no less).
@array = (); # Assign a null (empty) array, not a null (empty) string.
--
Larry Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 17 Jul 1998 16:58:07 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: How do I clear an array?
Message-Id: <6onvqv$7tr$3@marina.cinenet.net>
Robert Eric Pearse (pearse@mail.shebang.net) wrote:
: I've got all sorts of blocks within blocks. Inside one of the blocks I
: create an array of dir contents. Well, on the second go around, the
: array is simply appended with the contents of the second dir.
This is one good argument for lexical scoping. If you used
{
my @array;
...
}
to create a local array where it's needed, then you'd be guaranteed a
fresh, empty copy on each go-round with no additional work on your part.
And this is just one of many benefits you get from lexical scoping.
: And when I try to use the array my script dies because it references an
: array member from the wrong dir. (Well, it *really* dies because I told
: it to. Symantics, ain't they crazy. . .) Simple solution without
: rewriting code: clear the array.
:
: But, ' @array = ""; ' inserts a null value into the array. And when it
: accesses the null value in a dir, it barfs like my high school prom date
: after two Boones (Strawberry Hill, no less).
A vivid image, that. :) Let me ask you this: Why are you assigning a
scalar (the empty string) to an array? Shouldn't you be assigning lists
to arrays, in generaly? What does the empty *list* look like?
---------------------------------------------------------------------
| 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: Fri, 17 Jul 1998 17:04:36 GMT
From: sowmaster@juicepigs.com (Bob Trieger)
Subject: Re: How do I clear an array?
Message-Id: <6oo0bl$vho$3@strato.ultra.net>
[ posted and mailed ]
Robert Eric Pearse <pearse@mail.shebang.net> wrote:
-> Hey,
Hay is for horses, better for cow, but it gives me the shits.
-> But, ' @array = ""; ' inserts a null value into the array. And when it
-> accesses the null value in a dir, it barfs like my high school prom date
-> after two Boones (Strawberry Hill, no less).
Why are you trying to access the array after giving it a null value?
Perhaps a small snippet of your code will make it easier to understand what
you mean.
Bob Trieger
sowmaster@juicepigs.com
" Cost a spammer some cash: Call 1-800-400-1972
Ext: 1949 and let the jerk that answers know
that his toll free number was sent as spam. "
------------------------------
Date: Fri, 17 Jul 1998 17:19:50 +0000
From: Robert Eric Pearse <pearse@mail.shebang.net>
To: Larry Rosler <lr@hpl.hp.com>
Subject: Re: How do I clear an array?
Message-Id: <35AF87B6.26158C12@mail.shebang.net>
Larry,
Thanks. That's exactly what I was looking for.
You the man,
Robert
Larry Rosler wrote:
>
> In article <35AF7C72.32ECB48E@mail.shebang.net> on Fri, 17 Jul 1998
> 16:31:46 +0000, Robert Eric Pearse <pearse@mail.shebang.net> says...
> ...
> > But, ' @array = ""; ' inserts a null value into the array. And when it
> > accesses the null value in a dir, it barfs like my high school prom date
> > after two Boones (Strawberry Hill, no less).
>
> @array = (); # Assign a null (empty) array, not a null (empty) string.
>
> --
> Larry Rosler
> Hewlett-Packard Laboratories
> http://www.hpl.hp.com/personal/Larry_Rosler/
> lr@hpl.hp.com
--
Robert Eric Pearse
pearse@mail.shebang.net
"There's a monkey in my pants. . .and I like it."
------------------------------
Date: Fri, 17 Jul 1998 17:17:49 +0000
From: Robert Eric Pearse <pearse@mail.shebang.net>
To: Craig Berry <cberry@cinenet.net>
Subject: Re: How do I clear an array?
Message-Id: <35AF873D.F3D7F9F0@mail.shebang.net>
Craig,
> This is one good argument for lexical scoping. If you used
>
> {
> my @array;
> ...
> }
Cool, I always put off looking at that sort of stuff until my skills
expanded. I guess it's time.
> A vivid image, that. :) Let me ask you this: Why are you assigning a
> scalar (the empty string) to an array? Shouldn't you be assigning lists
> to arrays, in generaly? What does the empty *list* look like?
>
You tell me. I never looked at arrays as lists of lists. Although, they
can and often are. I've just used them in the following context.
while ($foo = readdir(DIR) {
@bar = (@bar, $foo)
}
Looks like I'm assigning scalars to an array here. . .
Thanks again,
Robert
--
Robert Eric Pearse
pearse@mail.shebang.net
"There's a monkey in my pants. . .and I like it."
------------------------------
Date: 17 Jul 1998 17:21:24 GMT
From: kortbein@iastate.edu (Josh Kortbein)
Subject: Re: How do I clear an array?
Message-Id: <6oo16k$qbj$1@news.iastate.edu>
Robert Eric Pearse (pearse@mail.shebang.net) wrote:
: But, ' @array = ""; ' inserts a null value into the array. And when it
@array = ();
Josh
--
__________________________________________
She had heard all about excluded middles;
they were bad shit, to be avoided.
- Thomas Pynchon
------------------------------
Date: Fri, 17 Jul 1998 16:14:27 GMT
From: pudge@pobox.com (Chris Nandor)
Subject: Re: How to interprete What Sucks/Rules?
Message-Id: <pudge-1707981213570001@dynamic434.ply.adelphia.net>
In article <35AF704D.37AEE347@shell.com>, Yong Huang <yong@shell.com> wrote:
# At http://www.tpj.com/tpj/rules/ and
# http://electriclichen.com/linux/srom.html, it talks about What
# Sucks/Rules. But the article is not clear as to the criterion.
>From the TPJ page:
I've written a tiny Perl program that uses LWP
and the GD module to perform an AltaVista
search for each of these languages, followed by
either "sucks" or "rules." It computes the
rule-to-suck ratio (higher is better) and plots the
result every hour.
# Seems the
# result comes from a Web search for "XXX rules" and "XXX sucks" strings
# and count them.
That's what it says.
# Can anybody explain?
Explain what?
# The fact that Java sucks even more
# than Visual BASIC seems to counteract most people's impression.
*shrug*
# Is the result really updated that often?
It says on the graphic it was updated Fri Jul 17 12:01:14 1998. Other
than that, I don't know what you want to know ...
--
Chris Nandor
http://www.petersons.com/
cnandor@pobox.com, chrisn@petersons.com
------------------------------
Date: 17 Jul 1998 16:20:45 GMT
From: lusol@turkey.cc.Lehigh.EDU
Subject: Re: How to interprete What Sucks/Rules?
Message-Id: <6ontkt$27qe@fidoii.cc.Lehigh.EDU>
Yong Huang <yong@shell.com> wrote in article <35AF704D.37AEE347@shell.com> :
>
>At http://www.tpj.com/tpj/rules/ and
>http://electriclichen.com/linux/srom.html, it talks about What
>Sucks/Rules. But the article is not clear as to the criterion. Seems the
>result comes from a Web search for "XXX rules" and "XXX sucks" strings
>and count them. Can anybody explain? The fact that Java sucks even more
>than Visual BASIC seems to counteract most people's impression.
>
>Is the result really updated that often?
On a related note:
http://tpj.com/tpj/rules
------------------------------
Date: Fri, 17 Jul 1998 10:08:25 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: How to interprete What Sucks/Rules?
Message-Id: <MPG.101924e07cd59c3a98971e@nntp.hpl.hp.com>
[This followup was posted to comp.lang.perl.misc and a copy was sent to
the cited author.]
In article <pudge-1707981213570001@dynamic434.ply.adelphia.net> on Fri,
17 Jul 1998 16:14:27 GMT, Chris Nandor <pudge@pobox.com> says...
...
> It says on the graphic it was updated Fri Jul 17 12:01:14 1998. Other
> than that, I don't know what you want to know ...
The timezone :-).
--
Larry Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 17 Jul 1998 17:23:43 GMT
From: kortbein@iastate.edu (Josh Kortbein)
Subject: Re: How to interprete What Sucks/Rules?
Message-Id: <6oo1av$qbj$2@news.iastate.edu>
Yong Huang (yong@shell.com) wrote:
: At http://www.tpj.com/tpj/rules/ and
: http://electriclichen.com/linux/srom.html, it talks about What
: Sucks/Rules. But the article is not clear as to the criterion. Seems the
: result comes from a Web search for "XXX rules" and "XXX sucks" strings
: and count them. Can anybody explain? The fact that Java sucks even more
: than Visual BASIC seems to counteract most people's impression.
Perhaps some normalization is in order. There are probably simply
more people talking about Java sucking. :)
Josh
--
__________________________________________
She had heard all about excluded middles;
they were bad shit, to be avoided.
- Thomas Pynchon
------------------------------
Date: Fri, 17 Jul 1998 17:10:19 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Lex for Perl / Object Dumper?
Message-Id: <Ew9118.8pr@world.std.com>
Paul <swoboda@uvic.ca> writes:
>Does anyone out there know if someone has hacked up
>even an alpha version of a lex/flex that generates Perl
>output (ie a yylex() routine, like "byacc -P" outputs a
>yyparse() routine)?
Have you thought of making an XS module that includes the C code
output by lex? I think all you would need is a C yyparse() that
converted its tokens to perl variables and called perl's yyparse().
--
Andrew Langmead
------------------------------
Date: Fri, 17 Jul 1998 13:18:31 -0400
From: "Dennis M. Parrott" <dparrott@ford.com>
To: ku@my-dejanews.com
Subject: Re: MIME types
Message-Id: <35AF8767.85F@ford.com>
ku@my-dejanews.com wrote:
>
> {snip!}
> I've been told I can do this by setting the MIME type
> of the HTML file to excel instead of text/html.
>
Actually, "setting the MIME type" is a misnomer. What
you need to do is send the *desired* MIME type in the
"Content:" header.
> Does anyone know the exact
> syntax to do this?
Yes, I am sure that lots of people do.
> I was not able to find it in the O'Reilly book or at
> www.perl.com Any help would be appreciated.
>
O'Reilly publishes many different books, maybe you
should consult a *different* one since the Perl books
(I am assuming that you were referring to the Perl
books) did not answer your question.
OTOH - this is really a CGI programming issue that is
only tangentially related to Perl. (i.e., this issue
would be *exactly* the same if you were coding in
Python, C, Fortran or COBOL [heaven forbid :^)])
I would suggest that this question be addressed to
the 'comp.infosystems.www.authoring.cgi' newsgroup.
HINT: there is a Perl-related book published by
O'Reilly that would answer this question. A red-
beaked, white bird graces its cover. (that statement
is sort of a riddle...)
> Thanks in advance, Kumar
>
> -----== Posted via Deja News, The Leader in Internet Discussion ==-----
> http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
--
-----------------------------------------------------------------------
Dennis M. Parrott | Unix: dparrott@ford.com
PCSE Webmaster | PROFS: DPARROTT
Ford Motor Company | VAX: EEE1::PARROTT
Dearborn, Michigan USA | public Internet: dparrott@ford.com
-----------------------------------------------------------------------
Voice: 313-322-4933 Fax: 313-248-1234 Pager: 313-201-9978
------------------------------
Date: 17 Jul 1998 16:26:45 GMT
From: Eli the Bearded <*@qz.to>
Subject: module forcing a reload of itself (a mod_perl question)
Message-Id: <eli$9807171210@qz.little-neck.ny.us>
In the mod_perl FAQ there is mention of how to have your modules
reloaded upon change. I'm am trying to get that to work, without
much success. I've got code like this:
use strict;
package King;
my $time;
sub init {
my $mtime=(stat '/home/qz/builds/apache_1.3.0/King.pm')[9];
if (!defined($time) or $mtime > $time) {
delete $INC{"King.pm"};
require King;
$time=$mtime;
}
}
sub handler {
# &init;
# toy code ...
}
1;
__END__
And I have it configured in like this in access.conf:
<Location /perl/king>
SetHandler perl-script
PerlHandler King
PerlSendHeader On
</Location>
As it runs now it does not reload if I change the file. I figured this
was because the King::init function was not being callled, so I tried
to call it myself from King::handler (the line is commented out). This
caused my server to core dump, so I don't think it is the right way to
go about this.
The mod_perl documentation seems very minimal. Where can I find more
information on using it? Where can I find sample code, preferably by
a variety of people?
Thanks,
Elijah
------
#!/usr/bin/perl -00-#rekcah lrep NEW YORK rehtona tsuj#_$ esrever ralacs tnirp
open 0;$_=<0>;s/[A-Z\s]*/reverse$&/eg;##;ge/&$esrever/*]s\Z-A[/s;>0<=_$;0 nepo
print scalar reverse $_#just another KROY WEN perl hacker#-00- lrep/nib/rsu/!#
------------------------------
Date: 12 Jul 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Mar 98)
Message-Id: <null>
Administrivia:
Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.
If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu.
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V8 Issue 3187
**************************************