[9357] in Perl-Users-Digest
Perl-Users Digest, Issue: 2952 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jun 23 17:08:29 1998
Date: Tue, 23 Jun 98 14:00:32 -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, 23 Jun 1998 Volume: 8 Number: 2952
Today's topics:
$^T <_wfenwick_@kingston.net>
Re: $^T (Larry Rosler)
Re: A funny problem with "use integer" <khera@kciLink.com>
AnyDBM_File doesn't define an EXISTS method Grehom@my-dejanews.com
Re: CGI Help Please <worker@capequip.com>
Re: CGI.pm without warnings? <khera@kciLink.com>
Re: Comparing conditional ? with if..else construct dgris@rand.dimensional.com
Re: Comparing conditional ? with if..else construct (Larry Rosler)
Comparing the contents of an array? <bth@acsu.buffalo.edu>
Re: Comparing the contents of an array? (Larry Rosler)
Re: Error creating file <altenbur@ncsa.uiuc.edu>
Exit status from system() not what I expected (and oth <mgregory@asc.sps.mot.com>
Re: Flames.... (Abigail)
Re: Flames.... <JdBornem@tivoli.com>
Re: Flames.... dgris@rand.dimensional.com
Internet Temps Perl listings <tomh@cyberzine.org>
Re: LWP::Simple on NT with a proxy / fire wall <aas@sn.no>
Re: LWP::Simple on NT with a proxy / fire wall (Jonathan Stowe)
Re: More Complete Delete Example <luckys@geocities.com>
moving perl -ne into a file? markf@acuityinc.com
Re: moving perl -ne into a file? <psdspss@execpc.com>
Re: moving perl -ne into a file? (Tad McClellan)
Multicast Sockets carruda@propub2.com
Re: Perl and MS SQL Server <rootbeer@teleport.com>
Placeholder item in qw// <achoy@us.oracle.com>
problem with array (Cesar Romani)
Re: problem with array <psdspss@execpc.com>
Re: problem with array (Larry Rosler)
Re: problem with array <psdspss@execpc.com>
Re: QUESTION: Why does only one of these work? (Mario D'Alessio)
Running virus scanner from Perl bidyut@yahoo.com
script to fill a form <natoofi@alborz.dac.neu.edu>
Re: sparse matrix (Josh Kortbein)
Re: stylistic remote array passing dgris@rand.dimensional.com
Tainting & Sockets Autoload problem <stowians@ford.com>
Re: Testing perl knowledge <mike@newfangled.com>
Re: Testing perl knowledge <merlyn@stonehenge.com>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 23 Jun 1998 16:09:18 -0400
From: Wynn Fenwick <_wfenwick_@kingston.net>
Subject: $^T
Message-Id: <35900B6E.A3FDCEA8@kingston.net>
What is the special variable $^T?
the line of code looks like...
$ary[$thisdate] = $^T;
I haven't been able to find anything on it.
Also, anyone know how to tell Dejanews that I actually want to search
for special characters like that...
Wynn
--
Remove the _'s to reply via email.
Wynn Fenwick
------------------------------
Date: Tue, 23 Jun 1998 13:35:43 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: $^T
Message-Id: <MPG.ff9b17612bf7db9896ba@nntp.hpl.hp.com>
In article <35900B6E.A3FDCEA8@kingston.net>, Wynn Fenwick
<_wfenwick_@kingston.net> says...
> What is the special variable $^T?
>
> the line of code looks like...
>
> $ary[$thisdate] = $^T;
>
> I haven't been able to find anything on it.
I found it by doing `perldoc perlvar`. Its English name is $BASETIME.
Does that help you?
> Also, anyone know how to tell Dejanews that I actually want to search
> for special characters like that...
I assume you mean the caret. I couldn't do it either.
--
Larry Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 23 Jun 1998 15:59:29 -0400
From: Vivek Khera <khera@kciLink.com>
Subject: Re: A funny problem with "use integer"
Message-Id: <x7k967c2ji.fsf@kci.kciLink.com>
>>>>> "IZ" == Ilya Zakharevich <ilya@math.ohio-state.edu> writes:
IZ> [A complimentary Cc of this posting was sent to Allan M. Due
IZ> <due@murray.fordham.edu>],
IZ> who wrote in article <6m9898$coh$0@206.165.146.32>:
>> |Yes. Upgrade.
>> Under which version of Perl does this behavior disappear? Stuck in my
>> Windoze world I can only attain 5.004_02,
IZ> Wrong. EMX version is at 5.004_55. And I think that anyone can
IZ> compile 5.004_04, which cures the fault.
Oh really?
[kci]% cat |perl
$a = "2709789211" ;
$b = "2706480429" ;
print $a - $b, "\n";
use integer ;
print $a - $b, "\n";
$a = "2709789211" ;
$b = "2706480429" ;
print $a - $b, "\n";
^D
3308782
3308782
0
[kci]% perl -v
This is perl, version 5.004_04 built for i386-bsdos
Copyright 1987-1997, Larry Wall
Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5.0 source kit.
--
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Vivek Khera, Ph.D. Khera Communications, Inc.
Internet: khera@kciLink.com Rockville, MD +1-301-258-8292
PGP/MIME spoken here http://www.kciLink.com/home/khera/
------------------------------
Date: Tue, 23 Jun 1998 19:46:55 GMT
From: Grehom@my-dejanews.com
Subject: AnyDBM_File doesn't define an EXISTS method
Message-Id: <6mp0nf$flo$1@nnrp1.dejanews.com>
#!/usr/bin/perl -w dbmopen %team, 'TEAM', 0777; while (<>) { chomp($_);
($code, $name) = split(/\W/,$_,2); if (exists $team{$code}) { print "code
already exists: ", $code, ":", $name, "\n"; } else { $team{$code} = $name;
} } dbmclose %team; ### above worked fine until I decided to store the data
in tied disk file (DBM) ### I'm new to Perl and I have RTFM and searched the
FAQs but maybe I can't see ### the wood for the trees. Any pearls of wisdom
much appreciated.
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: Tue, 23 Jun 1998 14:05:50 -0500
From: "Dr.V" <worker@capequip.com>
Subject: Re: CGI Help Please
Message-Id: <6moum4$b2k$1@supernews.com>
Thanks to All for your help!!
the thing that I did to get it to work was to try a different FTP program
to upload it under ASCII and then it worked =]
I Thank you for that suggestion and also for the "=" problem.
(now i wont drink as much.. ok may be not)
DrV.
------------------------------
Date: 23 Jun 1998 16:38:46 -0400
From: Vivek Khera <khera@kciLink.com>
Subject: Re: CGI.pm without warnings?
Message-Id: <x7iulrc0q1.fsf@kci.kciLink.com>
>>>>> "TM" == Tom Mornini <tmornini@netcom.com> writes:
TM> I've been developing an app with CGI.pm and have learned
TM> a great deal about it. I recently got down to some actual
TM> control code that decides what to do based upon multiple
TM> Submit buttons with different names with code that looks
TM> like this:
TM> if ($query->param('Submit') eq 'Button 1') {#code here}
If the button is not "pressed" on the form, then CGI.pm will not have
a value for the parameter 'Submit', so it returns the value undef.
Your conditional now becomes
if (undef eq 'Button 1') {#code here}
which will of course emit a nice warning in Perl.
Try this:
if (defined($query->param('Submit')) and
$query->param('Submit') eq 'Button 1') {#code here}
You must ensure the value exists before comparing it.
--
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Vivek Khera, Ph.D. Khera Communications, Inc.
Internet: khera@kciLink.com Rockville, MD +1-301-258-8292
PGP/MIME spoken here http://www.kciLink.com/home/khera/
------------------------------
Date: Tue, 23 Jun 1998 20:01:05 GMT
From: dgris@rand.dimensional.com
Subject: Re: Comparing conditional ? with if..else construct
Message-Id: <6mp104$6e$1@rand.dimensional.com>
[posted and mailed to the cited author]
In article <MPG.ff9839e58db68f09896b5@nntp.hpl.hp.com>,
Larry Rosler <lr@hpl.hp.com> wrote:
>So the situation then is this:
>
>Language Syntax Semantics
>
>C Invalid Irrelevant (doesn't compile)
>C++ Valid Defined; assignment is higher precedence than ?:
>Perl Valid Test ignored; value is that of expression after :
No, the test is not ignored. It's just that ?: is a valid
lvalue in perl (but it isn't in C or C++). Consider-
my $a = 5;
my $b = 6;
$b % 5 ? $a : $b += 5;
print "a: $a\n", "b: $b\n";
__END__
a: 10
b: 6
>Am I correct in inferring that Perl has the worst approach:
>valid syntax and screwed-up semantics?
The semantics of this are fine, just a little confusing until
you think about the lvalueness of ?:.
>This seems like an avoidable trap for the unwary (like the poster who
>started the thread). Perhaps some "anti-Gotcha!" treatment is desirable
>here. My choice would be to invalidate the syntax; the parse tree seems
>screwy in any case.
Invalidating lvalue conditionals would break a lot of code.
>--
>Larry Rosler
Regards,
Daniel
--
Daniel Grisinger dgris@perrin.dimensional.com
"No kings, no presidents, just a rough consensus and
running code."
Dave Clark
------------------------------
Date: Tue, 23 Jun 1998 13:25:50 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Comparing conditional ? with if..else construct
Message-Id: <MPG.ff9af273b900cab9896b9@nntp.hpl.hp.com>
[This followup was posted to comp.lang.perl.misc and a copy was sent to
the cited author.]
In article <6mp104$6e$1@rand.dimensional.com>, dgris@rand.dimensional.com
<dgris@rand.dimensional.com> says...
> In article <MPG.ff9839e58db68f09896b5@nntp.hpl.hp.com>,
> Larry Rosler <lr@hpl.hp.com> wrote:
>
> >So the situation then is this:
> >
> >Language Syntax Semantics
> >
> >C Invalid Irrelevant (doesn't compile)
> >C++ Valid Defined; assignment is higher precedence than ?:
> >Perl Valid Test ignored; value is that of expression after :
>
> No, the test is not ignored. It's just that ?: is a valid
> lvalue in perl (but it isn't in C or C++). Consider-
>
> my $a = 5;
> my $b = 6;
>
> $b % 5 ? $a : $b += 5;
> print "a: $a\n", "b: $b\n";
> __END__
> a: 10
> b: 6
...
But this is not the case under discussion. The code in question has an
assignment between the ? and the : like so:
$b % 5 ? $a += 2 : $b += 5;
How does *that* get parsed? The result is
a: 12
b: 6
To me, this is sort of loony!
--
Larry Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Tue, 23 Jun 1998 16:42:55 -0400
From: Bryan T Hoch <bth@acsu.buffalo.edu>
Subject: Comparing the contents of an array?
Message-Id: <Pine.GSO.3.96.980623163916.17934B-100000@joxer.acsu.buffalo.edu>
Hi,
I think this should be a simple question to answer, but I'm still not sure
of a good way to do it.
I want to compare the contents of two arrays. For example, if I have array
A and array B, I want to be able to go through and see which elements
array A has that array B doesn't have, and also which elements array B has
that array A doesn't have.
Is there a simple way of doing this?
Thanks in advance for your help.
Bryan H
------------------------------
Date: Tue, 23 Jun 1998 13:52:43 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Comparing the contents of an array?
Message-Id: <MPG.ff9b579fff716269896bb@nntp.hpl.hp.com>
In article <Pine.GSO.3.96.980623163916.17934B-
100000@joxer.acsu.buffalo.edu>, Bryan T Hoch <bth@acsu.buffalo.edu>
says...
> Hi,
> I think this should be a simple question to answer, but I'm still not sure
> of a good way to do it.
> I want to compare the contents of two arrays. For example, if I have array
> A and array B, I want to be able to go through and see which elements
> array A has that array B doesn't have, and also which elements array B has
> that array A doesn't have.
> Is there a simple way of doing this?
perlfaq4 is your friend:
How do I compute the difference of two arrays? How do I compute the
intersection of two arrays?
--
Larry Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Tue, 23 Jun 1998 15:17:40 -0500
From: david lee altenburg <altenbur@ncsa.uiuc.edu>
Subject: Re: Error creating file
Message-Id: <35900D64.DA36C543@ncsa.uiuc.edu>
Dave Lorand wrote:
>
>
> You should be checking what happens after each of these commands.
> Something like:
>
> if (not mkdir($dirname, 0777)) {
> warn "Could not mkdir $dirname: $!\n";
> }
> elsif (not open( COURSEFILE, ">$dirname/$filename" ) ) {
> warn "Could not open $dirname/$filename: $!\n";
> }
> elsif (not flock(COURSEFILE, LOCK_EX) ) {
> warn "Could not lock $dirname/$filename: $!\n";
> }
> print COURSEFILE $output;
> close(COURSEFILE);
>
> If it's OK for your script to die at this point, then you don't need the
> if ... elsif stuff - you can just do "mkdir (...) or die ..." etc.
>
> My humble guess, with only a few months experience, is that the mkdir is
> failing, so then of course you can't create a file in a non-existent
> directory. But, doing the above should help you troubleshoot it.
You're right. Had I put better error checking in, I woud have discovered that
it was faling on the mkdirbecause my permissions were set incorrectly. Oh,
well, you live and learn I guess. Thanks for your help,
though!
David Altenburg
altenbur@ncsa.uiuc.edu
------------------------------
Date: 23 Jun 1998 17:00:52 +0930
From: Martin Gregory <mgregory@asc.sps.mot.com>
Subject: Exit status from system() not what I expected (and other doc probs)
Message-Id: <r8hg1ch8wj.fsf@asc.sps.mot.com>
The documentation of system() says that if the program died from a
signal then the lower 8 bits of the return value will be set.
I have this in foo.pl:
eval '(exit $?0)' && eval 'exec perl -w -S $0 ${1+"$@"}' # -*- Perl -*-
& eval 'exec perl -w -S $0 $argv:q'
if 0;
my $ExitStatus = system("yes > /dev/null");
printf("Exit Status 0x%x\n",$ExitStatus);
and see this:
[djarraba-mg]{asc} foo.pl
Exit Status 0x8200
[djarraba-mg]{asc} foo.pl
Killed
Exit Status 0x8900
[djarraba-mg]{asc}
In the first case, I typed ^C at the command line.
In the second case I sent the 'yes' process a SIGKILL signal using top
(so I know that I killed the 'yes', not the perl process).
In neither case are the lower 8 bits set.
Note that the code on page 230 of the blue camel would, in this
instance, say
"ran with non-zero exist status 137"
which is not the right answer - the commentary implies that it would
say
"ran with signal <something sensible>"
However, the problem with the doco seems to run deeper than even that:
the code that is supposed to be determining whether a signal was
received checks to see if the value is > 0x80. This does not equate
to checking that none of the low bits are set (that would be > 0xFF).
Is this all completely up the broken, or what am I missing?
I really want to know how to tell whether the program got a signal,
because I want my calling program to die in that case. Specifically,
I want my program to die if the user types ^C (OK - sends SIGINT), but
I want it to keep going (noting the error) if the called program
returns an error status. I'm almost tempted to just see if bit 15 is
set and guess that this meant a signal hit, since this is what my
empricial evidence suggests!
Thanks!
(If its any use, I am on a Solaris machine, using perl 5.004_04)
Email copies of responses especially appreciated, since news gets here
slowly...
Thanks,
Martin.
------------------------------
Date: 23 Jun 1998 19:20:48 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Flames....
Message-Id: <6mov6g$4en$1@client3.news.psi.net>
Chris Nandor (pudge@pobox.com) wrote on MDCCLVI September MCMXCIII in
<URL: news:pudge-2206981240400001@dynamic52.ply.adelphia.net>:
++ In article <MPG.ff818231143d69e9896dd@nntp.hpl.hp.com>, lr@hpl.hp.com
++ (Larry Rosler) wrote:
++
++ # Maybe those who respond here 'Use grep, dammit!' will consider that they
++ # are adding yet another level of jargon to burden those struggling with
++
++ So? Look it up! If I type "grep definition" into Alta Vista, the first
++ thing that comes up is a Jargon File definition for grep, exactly what is
++ needed.
pudge++
Abigail
--
perl -weprint\<\<EOT\; -eJust -eanother -ePerl -eHacker -eEOT
------------------------------
Date: Tue, 23 Jun 1998 14:40:51 -0400
From: "J. Borneman" <JdBornem@tivoli.com>
Subject: Re: Flames....
Message-Id: <6mp0b2$2mj$1@tivoli.tivoli.com>
dgris@rand.dimensional.com wrote in message
<6mlpfl$bf2$1@rand.dimensional.com>...
>I consider it perfectly reasonable to expect people who are asking
questions
>about programming to know how to use their computer, to have read the
>relevant documentation, and to have read a newsgroup for at least a week
>before they begin posting (actually, I expect them to have read the group
>for at least six months, more if they have no experience on Usenet). If
>a person hasn't done these things then that person shouldn't post. If
>they do post, they deserve what they get. I'd never enter into an
>unfamiliar culture without taking the time to learn its values and
>customs, why should I put up with those with less respect for other
>people's time and energy.
six months? You would expect a person to read this group for _six_ months
before ever posting to it? _That_ is unrealistic. I started learning perl
about a year ago. I know jsut enough to do what I need to do, and have
learned msot of it through the purple Camel book. When I first started, I
read the group for maybe a week (that is a more reasonable number IMHO),
then posted my first question. I got about 50% harsh flames, 30% read the
docs, and 20% small hints and direction to the docs. That last 20% is what
I think is best. If they don't know what to do, give them a hint, then say
look at the docs. You don't need to go ripping off their heads for being
new at something.
You were new at this once too I assume? I don't see your name as Larry
Wall, so I'll assume you were a newbie once yourself. Don't coddle the
newbies, but don't berate them to the point that they don't _want_ to learn.
If in school every time you asked your teacher a question, she put you in
detention, you'd want to quit school pretty soon, right? Instead, teachers
give hints, show them where to find the books, and let them learn that way.
Much more civilized, and it creates much more learning on the part of the
newbie.
>If the flames convince others to _not_ post, then they are worth it.
>If the programmers are perceived as a bunch of unhelpful people who
>scream at newbies, well, at least the newbies will go away (perhaps
>back to lurker land until they know how to program).
What is so great about pushing newbies away? Why don't we help them become
non-newbies so that they may join and discuss things productively. If you
were to have your way, no newbies would ever enter the sacred cult of the
programmer. God forbid someone should ask a question that was said once in
a post 2 years ago, or something that is buried in once sentance of a
manpage somewhere.
yes, the stupid questions liek "How do I print text on the screen" should
be ignored or flamed, whatever. But don't go bashing anyone who doesn't
have a question about something that just may have been said before. And
God forbid, sin of all sins, someone should ask a CGI question.
Lighten up. Just remember, we were all newbies once.
------------------------------
Date: Tue, 23 Jun 1998 20:50:24 GMT
From: dgris@rand.dimensional.com
Subject: Re: Flames....
Message-Id: <6mp3sh$a9$1@rand.dimensional.com>
[posted and mailed to the cited author]
In article <6mp0b2$2mj$1@tivoli.tivoli.com>,
J. Borneman <JdBornem@tivoli.com> wrote:
>six months? You would expect a person to read this group for _six_ months
>before ever posting to it?
Why not? I read this group for two years before my first post.
>You were new at this once too I assume?
Yes, I still am, actually.
>What is so great about pushing newbies away?
You completely missed my point. The reason that newbies are being
pushed away is that newbies _shouldn't be posting here_. This is a
forum for perl programmers to discuss perl programming. If you can't
even the get syntax right you are not yet programming, you are learning
enough of the basics to become a programmer.
If you are learning, you should listen to the programmers, soak up
their advice, play with their code, and then start posting. You
shouldn't come in here expecting free training, though.
>If you
>were to have your way, no newbies would ever enter the sacred cult of the
>programmer.
No, only those motivated enough to learn would ever enter the `sacred
cult of the programmer', those who expect to have it handed to them
could live the rest of their lives writing in Visual Basic.
>Lighten up. Just remember, we were all newbies once.
Yes, we were. But not everyone is a newbie forever.
Regards,
Daniel
--
Daniel Grisinger dgris@perrin.dimensional.com
"No kings, no presidents, just a rough consensus and
running code."
Dave Clark
------------------------------
Date: 23 Jun 1998 20:26:39 GMT
From: "Tom Hicks" <tomh@cyberzine.org>
Subject: Internet Temps Perl listings
Message-Id: <01bd9ee2$5cd4f660$c67895cf@sparky2>
Keywords: Internet jobs, www jobs, web jobs, html jobs, resumes, perl
INTERNET TEMPS
http://www.idowebs.com/internettemps/internettemps.html
"People with Cyber related skills and those the need them."
A free search engine site. Post, Search, Modify listings.
Help Wanted and Help Offered listings.
Contact
tomh@ncfweb.net
Internet Temps
http://www.idowebs.com/internettemps/internettemps.html
------------------------------
Date: 23 Jun 1998 18:01:53 +0200
From: Gisle Aas <aas@sn.no>
Subject: Re: LWP::Simple on NT with a proxy / fire wall
Message-Id: <m37m285cpa.fsf@furu.g.aas.no>
David Coldrick <davidc@selectst.com> writes:
> Using GS port of Perl 5.004_02 on NT 4.
I am not sure which version of LWP this implies, but there was a
change for release 5.22 that might be relevant.
o LWP::Simple now switch to full LWP implementation even for systems
that force all environment keys to be upper case. Modification
suggested by Dale Couch <dcouch@training.orl.lmco.com>.
> I have a program that uses LWP::Simple to get() an http page that works
> fine when directly connected to the net, but the get() fails when I try
> it via a proxy.
>
> As I understand the doc, I should be able to specify the proxy via an
> environment variable http_proxy. I set a system variable http_proxy to
> n.n.n.n:80 (via the control panel), where the IP address is the one that
> successfully works as the proxy address with Netscape and IE, then ran
> the program, but the get() failed.
>
> Am I on the right track here?
You should be.
Regards,
Gisle
------------------------------
Date: Tue, 23 Jun 1998 20:41:59 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: LWP::Simple on NT with a proxy / fire wall
Message-Id: <35900ee3.10341004@news.btinternet.com>
On Wed, 24 Jun 1998 01:17:27 +1000, David Coldrick wrote :
>This is a multi-part message in MIME format.
>--------------91B6F6345EF6E03B6176F167
>Content-Type: text/plain; charset=us-ascii
>Content-Transfer-Encoding: 7bit
>
Please dont let your browser do that.
>Using GS port of Perl 5.004_02 on NT 4.
>
>I have a program that uses LWP::Simple to get() an http page that works
>fine when directly connected to the net, but the get() fails when I try
>it via a proxy.
>
<snip>
In the LWP::Simple doc it says:
The module will also export the LWP::UserAgent object as `$ua'
if you ask for it explicitly.
Right you have to do that and then read the LWP::UserAgent
documentation in order to find out to set the proxy details and do
that before you do your get.
Alternatively you may as well just use LWP::UserAgent from the
beginning;-}
/J\
Jonathan Stowe
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
------------------------------
Date: Tue, 23 Jun 1998 16:52:51 -0400
From: Luckys <luckys@geocities.com>
To: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: More Complete Delete Example
Message-Id: <359015A3.685E@geocities.com>
Now this is the answer I was looking for and suspected.
Thanks.
Eric Bohlman wrote:
>
> Luckys <luckys@geocities.com> wrote:
> : It may delete the input from the associative array but it doesn't seem
> : to delete it from the dbm file. Why? This is my question. (Your
> : example below doesn't seem to even write the associative array to the
> : dbm file.)
>
> The reason you can still see the key/value pair if you dump the dbm file
> is that when you delete an element from such a file, you don't actually
> overwrite the data with blanks or anything, you just remove a pointer to
> it. If, for security reasons, you need to destroy all evidence of the
> data, you'll need to copy the hash to another tied hash after doing all
> the deletions, and then you'll have to figure out how to "wipe" the old
> file before deleting it (since when you delete a file, you merely return
> the disk sectors it contains to the pool of free space, and The Enemy
> could grab hold of this data). How you do the latter is
> platform-dependent.
------------------------------
Date: Tue, 23 Jun 1998 12:00:00 -0700
From: markf@acuityinc.com
Subject: moving perl -ne into a file?
Message-Id: <358FFB30.F4B06DD3@acuityinc.com>
perl -ne 'print if (/LIB PART/ ? ($c = 18) : (--$c > 0))' proj.dat
This command line works fine, but I would like to put it into a file and
have the output put into an array, split if possible.
Thanks for any help, ideas or suggestions!
-Mark
------------------------------
Date: Tue, 23 Jun 1998 15:16:47 -0500
From: Deva Seetharam <psdspss@execpc.com>
Subject: Re: moving perl -ne into a file?
Message-Id: <35900D2F.AF8FE0DD@execpc.com>
markf@acuityinc.com wrote:
> perl -ne 'print if (/LIB PART/ ? ($c = 18) : (--$c > 0))' proj.dat
>
> This command line works fine, but I would like to put it into a file and
> have the output put into an array, split if possible.
>
> Thanks for any help, ideas or suggestions!
>
> -Mark
Look at perl faq at
http://www.perl.com/CPAN-local/doc/FAQs/FAQ/PerlFAQ.html#How_do_I_change_one_line_in_a_fi
for writing perl script, equivalent to a cmd.
Hope that helps.
Deva
------------------------------
Date: Tue, 23 Jun 1998 15:27:47 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: moving perl -ne into a file?
Message-Id: <343pm6.okh.ln@localhost>
markf@acuityinc.com wrote:
: perl -ne 'print if (/LIB PART/ ? ($c = 18) : (--$c > 0))' proj.dat
: This command line works fine, but I would like to put it into a file and
: have the output put into an array, split if possible.
: Thanks for any help, ideas or suggestions!
-----------------------
#!/usr/bin/perl -wn
print if (/LIB PART/ ? ($c = 18) : (--$c > 0));
-----------------------
heh, heh ;-)
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Tue, 23 Jun 1998 19:16:03 GMT
From: carruda@propub2.com
Subject: Multicast Sockets
Message-Id: <6moutj$cn7$1@nnrp1.dejanews.com>
Does the ActiveState Perl 316 build support Winsock2.0?
Namely the following:
setsockopt:
IPPROTO_IP
IP_ADD_MEMBERSHIP
IP_DROP_MEMBERSHIP
IP_MULTICAST_TTL
socket:
AF_INET
INADDR_ANY
SOCK_DGRAM
I've been having problems with "IP_ADD_MEMBERSHIP",
I get a WSAENOPROTOOPT (10042) Bad protocol option error when I
do the following:
(dummy,$dummy,$proto) = getprotobyname('udp');
socket($s,AF_INET,SOCK_DGRAM,$proto) || warn "Could not create socket: $!
\n"; setsockopt($s, IPPROTO_IP, IP_ADD_MEMBERSHIP, $mreq)
OUTPUT:
Unknown error: 0x0000273a
The socket seems to open okay, but when I "setsockopt" I get the above error.
Any ideas? Are multicast sockets supported?
Please copy my email account when you reply.
Thanks.
--
Charles Arruda
Progressive Publishing Inc.
Email: carruda@propub2.com
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: Tue, 23 Jun 1998 20:49:06 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Perl and MS SQL Server
Message-Id: <Pine.GSO.3.96.980623133659.3227D-100000@user2.teleport.com>
On Tue, 23 Jun 1998, Mike Criscolo wrote:
> when I actually use ISQL_w to run my
> query, the return value looks like:
>
> 0x0010000000005001
>
> When I use vec(), first, I have to skip the first byte (not exactly sure
> why), using a loop as follows:
>
> for ($i=1; $i<=16; $i++)
> {
> $val .= vec($value_from_DB, $i, 4);
> }
Are you skipping the first nybble, not the first byte? (And then, maybe,
reading one too many nybbles at the end?)
> the resultant string (0x chopped off):
>
> 0010000000005100
vec's ordering runs from low to high, in one byte at a time. I think that
you were expecting a different order. But you could do what you want (and
faster) with help from unpack, I'm pretty sure.
Good luck!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Tue, 23 Jun 1998 12:50:25 -0700
From: Allen Choy <achoy@us.oracle.com>
Subject: Placeholder item in qw//
Message-Id: <35900701.DE68D6EF@us.oracle.com>
Hi,
I was wondering if there was a way of putting a null item with qw//, as
you can with @z = ( undef )?
thanks in advance,
Allen
------------------------------
Date: 23 Jun 1998 19:31:34 GMT
From: romani_c@hotmail.com (Cesar Romani)
Subject: problem with array
Message-Id: <slrn6p00km.18h6.romani_c@rzaix38.rrz.uni-hamburg.de>
If I have:
@n=(1,2,3,4,5);
foreach (@n) {
print $n[$_],"\n";
}
That prints only
2
3
4
5
Why?
Thanks in advance.
--
Cesar Romani
Hamburg, Germany
------------------------------
Date: Tue, 23 Jun 1998 14:39:07 -0500
From: Deva Seetharam <psdspss@execpc.com>
Subject: Re: problem with array
Message-Id: <3590045B.B8D24CCF@execpc.com>
Cesar Romani wrote:
> If I have:
>
> @n=(1,2,3,4,5);
> foreach (@n) {
> print $n[$_],"\n";
> }
>
> That prints only
> 2
> 3
> 4
> 5
>
> Why?
>
> Thanks in advance.
>
> --
> Cesar Romani
> Hamburg, Germany
During iterations, $_ takes on the values 1,2,3,4,5.
So,
$n[1] is 2
$n[2] is 3.
The element $n[0] is never accessed.
If u are in doubt, use perl -d or print statements to debug
the flow.
Hope that helps.
Deva.
------------------------------
Date: Tue, 23 Jun 1998 12:46:08 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: problem with array
Message-Id: <MPG.ff9a5dcc1f06fa29896b8@nntp.hpl.hp.com>
In article <slrn6p00km.18h6.romani_c@rzaix38.rrz.uni-hamburg.de>, Cesar
Romani <romani_c@hotmail.com> says...
>
> If I have:
>
> @n=(1,2,3,4,5);
> foreach (@n) {
> print $n[$_],"\n";
> }
>
> That prints only
> 2
> 3
> 4
> 5
>
> Why?
Because by default array indexes start at 0. If you run your script with
the '-w' flag set (why don't you do that *all* the time?), you will get a
warning about accessing an undefined variable (namely, $n[5]).
--
Larry Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Tue, 23 Jun 1998 14:50:30 -0500
From: Deva Seetharam <psdspss@execpc.com>
Subject: Re: problem with array
Message-Id: <35900705.7E1FB3A3@execpc.com>
Cesar Romani wrote:
> If I have:
>
> @n=(1,2,3,4,5);
> foreach (@n) {
> print $n[$_],"\n";
> }
>
> That prints only
> 2
> 3
> 4
> 5
>
> Why?
>
> Thanks in advance.
>
> --
> Cesar Romani
> Hamburg, Germany
During iterations, $_ takes on the values of @n, which are 1,2,3,4,5.
So,
$n[1] is 2
$n[2] is 3.
The element $n[0] is never accessed.
If u are in doubt, use perl -d or print statements to debug
the flow.
Hope that helps.
Deva.
------------------------------
Date: 23 Jun 98 18:55:31 GMT
From: dalessio@manatee.cig.mot.com (Mario D'Alessio)
Subject: Re: QUESTION: Why does only one of these work?
Message-Id: <dalessio.898628131@manatee>
Thanks to all who answered the question for me.
Mario
**********************************************************
* ____ ____ ___ *
* __/\__ Mario D'Alessio ((oo)) //oo\\ /o o\ *
* \RUSH/ dalessio@cig.mot.com \__/ \__/ \_O_/ *
* |/\| Work: (847) 632-2323 Moe Larry Curly *
* 9am to 6pm Central Time *
* *
**********************************************************
------------------------------
Date: Tue, 23 Jun 1998 20:04:17 GMT
From: bidyut@yahoo.com
Subject: Running virus scanner from Perl
Message-Id: <6mp1o1$hic$1@nnrp1.dejanews.com>
Hi there, I have windows NT 4.0 server and i am running activestate perl for
my CGI on web. Now my cgi requires to done thing.. every time a user uploads
a file via internet, this CGI should run a virus scanner which will check
whether the file is infected or not.
So how can i call a virus scanner like McAfee or Norton from Perl to do a
virus checking??
any help in this regard will be of great help
Thanks
bye
Bidyut
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: Mon, 22 Jun 1998 10:33:46 -0400
From: <natoofi@alborz.dac.neu.edu>
Subject: script to fill a form
Message-Id: <Pine.LNX.3.96.980622103056.12585C-100000@alborz.dac.neu.edu>
Hello:
Is there a way that I can connect to some httpd server ( e.g.
www.blah.blah ) and fill up a form, press send buttom and then quit.
Navid
------------------------------
Date: 23 Jun 1998 17:20:03 GMT
From: kortbein@iastate.edu (Josh Kortbein)
Subject: Re: sparse matrix
Message-Id: <6moo43$sf6$2@news.iastate.edu>
Richard Kerr (rkerr1@geegee.une.edu.au) wrote:
: Has anyone used perl to create a sparse matrix ? Does the module Math:
: cover sparse matrices ?
_Advanced Perl Programming_ discusses using hashes of hashes, IIRC,
to represent sparse matrices.
Josh
_________________________________________________________
I do not trust your bitch.
- Frederich Nietzche, in _Also Sprach Zarathustra_
------------------------------
Date: Tue, 23 Jun 1998 19:44:24 GMT
From: dgris@rand.dimensional.com
Subject: Re: stylistic remote array passing
Message-Id: <6movuh$ut7$1@rand.dimensional.com>
[posted and mailed to the cited author]
In article <tfo-2306981138100001@jesus.telalink.net>,
Thomas Frederick O'Connell <tfo@telalink.net> wrote:
<snip description of actually reading the docs :-)>
>is there a graceful way to pass arrays between different hosts (or even
>different scripts, i guess)? i have a script that needs to distribute
>
Two words- Data::Dumper.
Data::Dumper allows you to convert complex perl objects into a
string format suitable for saving as a text file or for sending
across the network. Like this-
$ perl
use strict;
use Data::Dumper;
my $a = ['this',
{
'is' => 'a',
'test' => 'of'
},
'the',
[qw/data dumper module/]
];
print "Output:\n";
print Dumper($a);
__END__
Output:
$VAR1 = [
'this',
{
'test' => 'of',
'is' => 'a'
},
'the',
[
'data',
'dumper',
'module'
]
];
It is somewhat 0 to the `pickle' module
that the Python guys are so big on :-). I use
it in nearly every program that I write in perl
(it's also great for debugging).
It is available on CPAN and I think it's supposed to
be a part of 5.005, although I may be mistaken on
that.
>
>thanks be unto all donors of aid and/or information.
>-freddie
Hope this helps,
Daniel
--
Daniel Grisinger dgris@perrin.dimensional.com
"No kings, no presidents, just a rough consensus and
running code."
Dave Clark
------------------------------
Date: Tue, 23 Jun 1998 16:46:21 -0400
From: Stan Towianski <stowians@ford.com>
Subject: Tainting & Sockets Autoload problem
Message-Id: <3590141D.6743@ford.com>
Hi,
I am playing with the client/server example in the "Programming Perl"
book, chapter 6: Social Engineering -> "Cooperating with other
Processes". I got a version to work, but now we are wanting to find out
what can be done to make this comply with security here so that it can
be safely used. Looking around I found out about "Tainting" and that it
could be forced on with a -T option. The only thing is it says the
program is unsafe right away and does not start. If I start normally it
works:
=>perl server.p
server.p 7702: server started on port xx at Tue Jun 23 16:00:10 1998
If I want to use -T it does:
=>perl -T server.p
Insecure dependency in require while running with -T switch at
/xxx/perl/perl-5.003/lib/AutoLoader.pm line 69.
at /xxx/perl/perl-5.003/lib/Socket.pm line 142
Insecure dependency in require while running with -T switch at
/xxx/perl/perl-5.003/lib/AutoLoader.pm line 69.
at /xxx/perl/perl-5.003/lib/Fcntl.pm line 29
Insecure dependency in eval while running with -T switch at
/xxx/perl/perl-5.003/lib/Socket.pm line 268.
=>
When I look at these I see that:
Socket.pm line 142:
use AutoLoader;
AutoLoader.pm line 69 is the eval() line below:
# If that failed, try relative path with normal @INC searching.
if ($@) {
$path ="auto/$callpack/autosplit.ix";
eval { require $path; };
}
Fcntl.pm line 29 is:
use AutoLoader;
Socket.pm line 268 is the eval() line again:
...
}
eval "sub $AUTOLOAD { $val }";
goto &$AUTOLOAD;
}
It seems to not like Autoload and to not like eval().
I thought it might not like autoload because it loads program
code at run time when it is needed, so I thought about trying
to add the code from Autoload.pm, and fcntl.pm, and Socket.pm
right into my server code to bypass this but it gave me a lot
of errors and I might not know enough about it to make it work.
Earlier I have seen something in the book about 'Safe' also,
and 'Penguin', but don't know what to do with those.
At this point I am looking for knowledgeable suggestions.
Should I try to put all the code together into one program like
I thought?
or If I limit the server program to only being able to do hardcoded
commands, and I make the program only executable by
others and not even 'readable', will that be safe enough to keep
it from being used like an 'rsh' without a login prompt?
We probably for one want it to be used in a Web application to have the
web server run a remote command on another server and return the results
in a CGI fashion.
Thanks.
Stan.
stowians@ford.com
------------------------------
Date: Tue, 23 Jun 1998 15:35:30 -0400
From: "Michael S. Brito, Jr." <mike@newfangled.com>
Subject: Re: Testing perl knowledge
Message-Id: <3590037E.31931C0D@newfangled.com>
Is there no perl certification, or atleast certificate of completion for
some perl course????????
Perry Statham wrote:
> My boss just informed me that as the resident perl "expert" he would
> like me to interview some job candidates for their perl knowledge. Does
> anyone out there have any tests or lists of questions they have come up
> with in the past to interview for this?
>
> Please CC: your answers to me at pstatham@dev.tivoli.com.
> Thanks - Perry Statham
-----------------------------------------------------------
Michael S. Brito, Jr., Web Developer
Newfangled Graphics Co. Inc.
mike@newfangled.com
#!/bin/perl -sp0777i<X+d*lMLa^*lN%0]dsXx++lMlN/dsM0<j]dsj
$/=unpack('H*',$_);$_=`echo 16dio\U$k"SK$/SM$n\EsN0p[lN*1
lK[d2%Sa2/d0$^Ixp"|dc`;s/\W//g;$_=(#####censored######)
-----------------------------------------------------------
------------------------------
Date: Tue, 23 Jun 1998 20:01:44 GMT
From: Randal Schwartz <merlyn@stonehenge.com>
Subject: Re: Testing perl knowledge
Message-Id: <8cvhpr3n1f.fsf@gadget.cscaper.com>
>>>>> "Michael" == Michael S Brito, <mike@newfangled.com> writes:
Michael> Is there no perl certification, or atleast certificate of
Michael> completion for some perl course????????
There is no formal "certification" for Perl, although a few people
have set up "mock" certification sites to make fun of the whole
process.
Most of the corporations where my instructors teach Perl have some
sort of completion certificate, signed by us. And my open courses
also have a completion certificate (with the fancy Stonehenge logo and
everything).
But it's generally just enough to tell your employer that "I took a
class from Stonehenge instructors" presuming they are net savvy.
There's no point in lying about that. :)
print "Just another Perl hacker," # but not what the media calls "hacker!" :-)
## legal fund: $20,990.69 collected, $186,159.85 spent; just 69 more days
## before I go to *prison* for 90 days; email fund@stonehenge.com for details
--
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@teleport.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me
------------------------------
Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Mar 97)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V8 Issue 2952
**************************************