[7826] in Perl-Users-Digest
Perl-Users Digest, Issue: 1451 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Dec 10 22:07:23 1997
Date: Wed, 10 Dec 97 19:00:23 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Wed, 10 Dec 1997 Volume: 8 Number: 1451
Today's topics:
Re: a certain bug...!!! <rootbeer@teleport.com>
Re: Accessing DEC OSF1 Oracle db from Linux box (John D Groenveld)
Re: CPAN on CD is not evil (was Re: Resource Kit Anomal (Brandon S. Allbery KF8NH; to reply, change "void" to "kf8nh")
Download Question <nash@tuipgraphics.com>
Finding Live Process <sc2784@email.mot.com>
Re: Finding Live Process (Matthew Cravit)
Re: Finding Live Process <rhodri@wildebst.demon.co.uk>
Re: format NAME = <rootbeer@teleport.com>
Re: Memory & Page Size <rootbeer@teleport.com>
Mysql -> DBI (Ian Baker)
Re: need to know what browser the client is using <rootbeer@teleport.com>
Re: need to know what browser the client is using <rhodri@wildebst.demon.co.uk>
Re: newbie: compact an array (Jason Gloudon)
Re: newbie: compact an array (Jonathan Stowe)
Re: newbie: compact an array <rhodri@wildebst.demon.co.uk>
Re: newbie: compact an array <rootbeer@teleport.com>
Re: print buffer flush <beans@bedford.net>
Question <e.phillips@mindspring.com>
recursive regex? (Gregory Coleman)
Re: Retrieving keys/values from %param in creating orde <chenyang@mashie.ece.jhu.edu>
Re: Returning information from an nslookup ?? (Michael Fuhr)
Re: simple array problem parsing a cookie <rootbeer@teleport.com>
sorting a hash of hashes??? (Lawrence J. Wobker)
Re: sorting a hash of hashes??? (Lawrence J. Wobker)
Re: Taking document in directories and replacing them d <rootbeer@teleport.com>
Re: There's More Than One Way? <rootbeer@teleport.com>
Re: Wanted: Perl5 script to scan+kill POP3 mailbox (Sean Dowd)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 10 Dec 1997 17:13:14 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Christian Khoury <Christian.Khoury@inria.fr>
Subject: Re: a certain bug...!!!
Message-Id: <Pine.GSO.3.96.971210170318.6051D-100000@user2.teleport.com>
On Wed, 10 Dec 1997, Christian Khoury wrote:
> i read in "Programming Perl" (2nd edition) that i just need to add a
> "+>" to a file's name to be able to open it in read write mode...i tried
> it and it failed....but with "+<", it worked fine...
>
> is this a known bug?
What Perl does for me when I do as you describe is not a bug. :-)
Opening with "+<" is opening an _existing_ file for input, also with the
ability to write to it. If the file doesn't exist, the open should fail.
(As it does when you open with "<".)
Opening with "+>" is opening a _new_ file for output, also with the
ability to read from it. If the file already exists, it should be wiped
out. (As it does when you open with ">".)
Opening with "+>>" is opening a file for appending, also with the ability
to read from it. If the file exists, new data may be added at the end. If
it doesn't exist, it should be created. (As it does when you open with
">>".)
Would that be the behavior you're seeing?
Naturally, you should choose one of these based upon the questions "Do you
want to retain existing data in the file?" and "Do you want to require the
file to already exist?"
Require file Retain data
Yes Yes +<
No Yes +>>
No No +>
There's no obvious way to require a file whose data you don't want.
Fortunately, that's not likely to be needed. :-)
Hope this helps!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: 10 Dec 1997 19:34:25 -0500
From: groenvel@cse.psu.edu (John D Groenveld)
Subject: Re: Accessing DEC OSF1 Oracle db from Linux box
Message-Id: <66nceh$64o$1@tholian.cse.psu.edu>
In article <yd1hg8pt2vw.fsf@splat.niehs.nih.gov>,
Lance A. Brown <brown9@niehs.nih.gov> wrote:
>Is there anything I can use to access an Oracle database running on a
>DEC OSF1 3.2 system from a Linux system running perl5? It appears
>that DBD::Oracle needs the actual Oracle libraries on the client machine.
DBD::pNet?
http://www.perl.org/CPAN/modules/00modlist.long.html#7)DatabaseInter
Oracle for SCO under iBCS?
http://www.dejanews.com/
John
groenvel@cse.psu.edu
------------------------------
Date: Wed, 10 Dec 97 20:38:30 -0500
From: bsa@void.apk.net (Brandon S. Allbery KF8NH; to reply, change "void" to "kf8nh")
Subject: Re: CPAN on CD is not evil (was Re: Resource Kit Anomaly)
Message-Id: <348f451b$6$ofn$mr2ice@speaker>
In <881792134.754772@cabal>, on 12/10/97 at 10:17 PM,
? the platypus {aka David Formosa} <dformosa@st.nepean.uws.edu.au> said:
+-----
| >> "Would you really want to take Web publishing advice from someone who
| >> had to burn a CD-ROM to distribute his software?
| >I fail to see how him including a CD-ROM implies that he `had to burn a
| >CD-ROM to distribute his software'.
| Indeed, sneekernet while having high latency also has rather good
| bandwidth. When you are out in the sticks (network wise) a good CD-ROM is a
| god send.
+--->8
How soon we forget....
"Never underestimate the bandwidth of a truck full of magtapes, hurtling down
the highway." These days it'd be a truckful of CDs or Zip/Jaz disks or
TR-3's, etc., but the point is only enhanced thereby.
Even when *not* out in the sticks, a CD-ROM drive is a good deal faster than a
network connection. Even a cable modem connection, unless you're still
holding on to your old, slow drive for sentimental reasons :-) :-)
--
use 5.004;sub AUTOLOAD{print$_{$_.++$x{$_}}}sub new{my%x;%_=map{++$a%2?$_.++$x{
$_}:$_}split(//,pack('N*',unpack('w*',unpack('u*','M@H*HP\'2"@\C`88+SE/!EA(F!'.
"A'6\$LZV0+(3;C9QRA9NAPG2&D\\G(88:KL=A0\n4AN.5W\"\"&\\[W>;H>3S>0\@A\\N\@PB\$`")
)));bless{}}$b=(new main);map{$b->_}split(//,' Brandon S. Allbery KF8NH') # :-)
------------------------------
Date: Wed, 10 Dec 1997 16:22:20 -0800
From: Nash Weber <nash@tuipgraphics.com>
Subject: Download Question
Message-Id: <348F323C.D58D213D@tuipgraphics.com>
I've written a CGI script in PERL 4 that allows users to browse an image
database and select images they want to download. Once they've made all
their selections, this script gathers all these files, zip's them and
downloads the archive through the requesters browser. It all works
except ONE small problem. The archive that the client receives is
always entitled mail.pl which is the name of the perl script.
HOW CAN I DOWNLOAD THE ARCHIVE TO THE CLIENT WITHOUT HAVING THE ARCHIVE
RENAMED TO THE NAME OF THE SCRIPT THAT CALLS IT?? Any ideas???
-Nash
nash@tulipgraphics.com
San Francisco, CA USA
------------------------------
Date: Wed, 10 Dec 1997 18:53:09 -0600
From: Brett Berry <sc2784@email.mot.com>
Subject: Finding Live Process
Message-Id: <881768393.1548288004@dejanews.com>
I am looking for a PERL call to tell me if a certain PID is alive or not.
Currently I am having to put the contents of `ps -ef` into an array, and
parse it.
Thanks In Advance,
Brett Berry
UNIX Systems Admin.
Motorola IRIDIUM Project
sc2784@email.mot.com
http://www.freeyellow.com/members2/bdma/index.html
-------------------==== Posted via Deja News ====-----------------------
http://www.dejanews.com/ Search, Read, Post to Usenet
------------------------------
Date: 10 Dec 1997 17:17:59 -0800
From: mcravit@best.com (Matthew Cravit)
Subject: Re: Finding Live Process
Message-Id: <66nf07$sj9$1@shell3.ba.best.com>
In article <881768393.1548288004@dejanews.com>,
Brett Berry <sc2784@email.mot.com> wrote:
>I am looking for a PERL call to tell me if a certain PID is alive or not.
You do it in perl the same way you do it in any other UNIX programming
language. From the perlipc manual page (perldoc perlipc):
> Another interesting signal to send is signal number zero.
> This doesn't actually affect another process, but instead
> checks whether it's alive or has changed its UID.
>
> unless (kill 0 => $kid_pid) {
> warn "something wicked happened to $kid_pid";
> }
Hope this helps.
/MC
--
Matthew Cravit, N9VWG | Experience is what allows you to
E-mail: mcravit@best.com (home) | recognize a mistake the second
mcravit@taos.com (work) | time you make it.
------------------------------
Date: Thu, 11 Dec 1997 01:41:40 +0000 (GMT)
From: Rhodri James <rhodri@wildebst.demon.co.uk>
Subject: Re: Finding Live Process
Message-Id: <47f6904cd8rhodri@wildebst.demon.co.uk>
In article <881768393.1548288004@dejanews.com>,
Brett Berry <sc2784@email.mot.com> wrote:
> I am looking for a PERL call to tell me if a certain PID is alive
> or not. Currently I am having to put the contents of `ps -ef` into
> an array, and parse it.
I believe 'kill 0, $pid;' will do what you are after, returning 1 if the
process is alive (i.e. 1 signal could have been sent).
--
Rhodri James *-* Wildebeeste herder to the masses
If you don't know who I work for, you can't misattribute my words to them
... Lucy and Ethel?
------------------------------
Date: Wed, 10 Dec 1997 17:22:45 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Phil R Lawrence <prl2@lehigh.edu>
Subject: Re: format NAME =
Message-Id: <Pine.GSO.3.96.971210172158.6051G-100000@user2.teleport.com>
On 10 Dec 1997, Phil R Lawrence wrote:
> Some of the addresses returned in the code below have only 1 or 2 of the 3
> possible address lines. Is there a way to modify the format statament to
> cut those lines if unused?
Do you know what the ~ (and ~~) do in formats? Hope this helps!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: Wed, 10 Dec 1997 17:26:48 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Michael Genovese <mikeg@NOSPAMPLEASE.slpma8.ed.ray.com>
Subject: Re: Memory & Page Size
Message-Id: <Pine.GSO.3.96.971210172527.6051I-100000@user2.teleport.com>
On Wed, 10 Dec 1997, Michael Genovese wrote:
> Is there a way (or set of ways, as this Perl script is
> meant to eventually work on several UNIX platforms) to
> find :
>
> * Memory Size (real physical memory)
> * Page Size
>From the programmer's standpoint, there's no general way to see those
things from within Perl. You may be able to write an XSUB or external
program to do that, though. Good luck!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: 11 Dec 1997 02:10:37 GMT
From: ian@sonic.net (Ian Baker)
Subject: Mysql -> DBI
Message-Id: <66ni2t$jn0$1@ultra.sonic.net>
Disclaimer: I'm fairly new to the relational database world.
I've been working with Mysql.pm v1.17 (in combination with Mysql v3.20.31e)
for a little while... Much to my chagrin, when we upgraded our perl
installation (and Mysql.pm, to v1.1821), I found that the Mysql development
world is (seemingly) trying to standardize on DBI.
I don't have a problem converting my code to DBI (it looks like most of the
transition should be fairly painless, and I should have probably been using
that API from the beginning) but I have a problem. I'm making use of the
insert_id method in Mysql.pm, and can't find a DBI counterpart. Am I
overlooking someting, or is nothing like that implemented?
TIA...
--
Ian Baker Sonic
(707)522-1001 (33.6kbps) (707)522-1000 (Voice)
mailto:support@sonic.net http://www.sonic.net
------------------------------
Date: Wed, 10 Dec 1997 17:18:19 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Ricky <ric@megsinet.net>
Subject: Re: need to know what browser the client is using
Message-Id: <Pine.GSO.3.96.971210171333.6051E-100000@user2.teleport.com>
On Wed, 10 Dec 1997, Ricky wrote:
> Newsgroups: comp.lang.perl.misc, comp.lang.perl.modules, comp.lang.perl
comp.lang.perl is dead. This question has nothing to do with modules. And
I doubt that it has anything to do with Perl, for that matter.
> Subject: need to know what browser the client is using
Sounds like a CGI question, not a Perl question...
> i have no idea what "name" for AOL would be in the environment
> variable. shoot, i don't even know the name for netscape or IE. how
> can i check for them if i don't know what to check for?
Yep, not a Perl question. The key is, if the answer is the same whether
you're programming in Perl, C, or Visual Modula 17++ with JavaBeans and
Digital Satellite TV Support, then it's not a Perl-specific question.
> in a nutshell, i need to know what name is used for AOL, IE, and
> Netscape that is stored in the HTTP_USER_AGENT environment variable,
If you must, try asking in a newsgroup about browsers or CGI scripting.
They'll probably tell you that it's a waste of time to try to tell what
browser somebody is using, though. Good luck!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: Thu, 11 Dec 1997 00:24:20 +0000 (GMT)
From: Rhodri James <rhodri@wildebst.demon.co.uk>
Subject: Re: need to know what browser the client is using
Message-Id: <47f6893898rhodri@wildebst.demon.co.uk>
In article <348EE1CC.10F4F820@megsinet.net>,
Ricky <ric@megsinet.net> wrote:
> hey all! ok, i'm another one of those perl newbies y'all are probably
> sick of but i'm kinda stuck so here's my question.
OK. Before you fire away, might I suggest that cross-posting to all the
Perl groups was not necessarily the best way to make friends (there is a
reason why they are split up, you know), particularly given that
comp.lang.perl is supposed to be defunct. I've trimmed this response to
comp.lang.perl.misc, myself.
> there's this page i have.
Oh. <Manuel>I know nah-theeeng.</Manuel> Maybe a CGI group would be more
likely to give you helpful advice, as the FAQ suggests?
> i rigged it with javascript to open another little window on top
> of it when it loads (onLoad=littlewindow( ) ), but, it's a problem
> with AOL users. it works fine with netscape and IE, but totally
> screws up on AOL.
Since I don't know anything about the subject (in Perl/CGI terms), I will
merely offer the observation that your page is going to break on a lot
more browsers than whatever AOL provide. It won't work on mine, for
instance, since that doesn't support JavaScript at all. Congratulations,
however, on thinking to try your page out on more than just Netscrape and
Internet Exploder! I wish more alledged web design experts were that
bright!
--
Rhodri James *-* Wildebeeste herder to the masses
If you don't know who I work for, you can't misattribute my words to them
... Intel Outside
------------------------------
Date: Thu, 11 Dec 1997 00:24:46 GMT
From: jgloudon@bbn.subtleantispam.com (Jason Gloudon)
Subject: Re: newbie: compact an array
Message-Id: <ipGj.95$ea2.3477836@cam-news-reader1.bbnplanet.com>
Xah (xah@best.com) wrote:
: Suppose @a is an array of integers. I want to compact @a, so that elements
: that are 0 get deleted. How can I do this without declaring another array @b
: such as:
Something like this:
for($i=0;$i<@a;$i++){
if($a[$i] eq '0'){
splice (@a,$i,1);
}
}
Jason Gloudon
------------------------------
Date: 11 Dec 1997 00:53:22 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: newbie: compact an array
Message-Id: <66ndi2$kvf@argon.btinternet.com>
In article <66n3jh$617$1@nntp1.ba.best.com>, xah@best.com says...
>
>Suppose @a is an array of integers. I want to compact @a, so that
elements
>that are 0 get deleted. How can I do this without declaring another
array @b
>such as:
>
># compact array
>$j=0;
>foreach $i (@a) {if ($i) {@b[$j] = $i; $j++;};};
>
The splice function will remove elments from an array. Check out the
docs.
Jonathan
------------------------------
Date: Thu, 11 Dec 1997 00:36:23 +0000 (GMT)
From: Rhodri James <rhodri@wildebst.demon.co.uk>
Subject: Re: newbie: compact an array
Message-Id: <47f68a52f0rhodri@wildebst.demon.co.uk>
In article <66n3jh$617$1@nntp1.ba.best.com>,
Xah <xah@best.com> wrote:
> Suppose @a is an array of integers. I want to compact @a, so that
elements
> that are 0 get deleted. How can I do this without declaring another
array @b
> such as:
> # compact array
> $j=0;
> foreach $i (@a) {if ($i) {@b[$j] = $i; $j++;};};
That looks like a fairly neat way of doing it. If you really mustn't
create a new array, you could use splice() to knock out array elements,
but I'm not sure how good an idea it would be under the circumstances.
Try:
# WARNING: untested code
$i = 0;
while ($i <= $#a)
{
if ($a[$i] == 0) { splice @a, $i, 1; } else { $i++; };
}
Not the world's tidiest code :-)
--
Rhodri James *-* Wildebeeste herder to the masses
If you don't know who I work for, you can't misattribute my words to them
... Now that the deadline's past, can I have the spec please?
------------------------------
Date: Wed, 10 Dec 1997 18:06:36 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Xah <xah@best.com>
Subject: Re: newbie: compact an array
Message-Id: <Pine.GSO.3.96.971210180535.6051N-100000@user2.teleport.com>
On Wed, 10 Dec 1997, Xah wrote:
> Suppose @a is an array of integers. I want to compact @a, so that
> elements that are 0 get deleted.
Use grep, or splice. splice is better if the list may be quite large. Hope
this helps!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: 11 Dec 97 01:06:41 GMT
From: Tom <beans@bedford.net>
Subject: Re: print buffer flush
Message-Id: <348f3ca1.0@news3.paonline.com>
Mousheng Xu <mxu@eecs.ukans.edu> writes: > Dear Experts and Semi-experts:
>
> I am dealing with very large files, the problem is that the "print"
...
> So, if I do want the order of printing, what can I do? I am trying to
> flush the printing buffer everytime it prints, but there is not a
> "fflush" function in Perl.
> Any help is highly appreciated.
> Thanks a lot.
>
> Sincerely,
> Mousheng Xu
You should have "flush.pl" in your Lib directory.
You'll need to add a require "flush.pl" and use &printflush
instead of print.
-Tom
------------------------------
Date: Tue, 9 Dec 1997 19:00:46 -0800
From: "Eric Phillips" <e.phillips@mindspring.com>
Subject: Question
Message-Id: <66naer$fqb@camel12.mindspring.com>
Hello, I am a new Perl programmer, sort of, and I have a question.
I am writing a script that does a lot of things, but right now I am having
problems, well I really don't know how to do it, with reading a ".dat" file,
which will search for a login and a password.
Here's the format of the ".dat" file:
|login|password
Please help me read the login and password and compare them in the ".dat"
file to see if they are correct. Thanks!!
PS: All I need to know is how to compare the login and password from the
form to the ones in the ".dat" file. Thanks, and let me know!
--
Eric Phillips
TigerWeb - http://twb.starhosting.com
info@twb.starhosting.com
------------------------------
Date: 11 Dec 1997 02:03:10 GMT
From: coleman@library.ucsf.edu (Gregory Coleman)
Subject: recursive regex?
Message-Id: <66nhku$1oq8@itssrv1.ucsf.edu>
greetings:
Though I probably could've looked harder, I have still yet to know if this is a common scenario.
Basically, I just want to go through a file system, and look at each level of directories and scan for something. For example, say I have user's home directories, and I am getting ready to change the path to perl. I want to know who all has "#!/usr/local/bin/perl" so that I might later change it.
Yes, I would glob, and yes I would do regexp; I am just wondering if anybody has done this in a way that really shines.
Is this so common I can't see the forest for the trees?
thanx,
gleeco
--
<----Gregory Coleman -- Library & Center for Knowledge Management -- UCSF---->
------------------------------
Date: Mon, 8 Dec 1997 01:34:26 -0500
From: Chenyang Xu <chenyang@mashie.ece.jhu.edu>
Subject: Re: Retrieving keys/values from %param in creating order?
Message-Id: <Pine.SGI.3.91.971208013238.1103E-100000@mashie.ece.jhu.edu>
On Fri, 5 Dec 1997, Mike Stok wrote:
> In article <348427C0.41C6@mashie.ece.jhu.edu>,
> Chenyang Xu <chenyang@mashie.ece.jhu.edu> wrote:
> >Hello,
> >
> > I am wondering how to retrieve keys/values pair from associate array
> >say %param in the order they are created.
> >
> > Thanks for any suggestions and help.
>
> One thiong you might do is use the Tie::IxHash module which can be found
> on any CPAN site. The README says:
>
> This is the README file for Tie::IxHash, the Perl module that
> implements ordered in-memory associative arrays.
>
> It requires:
> Perl Version 5.003 or later.
>
> If you have been led to believe that associative arrays in perl
> don't preserve order, and if you have ever craved for that feature,
> this module is for you. Simply declare a "tie" for the hash variable
> that you want to be order-preserving, and forget that limitation
> ever existed. You can do other nifty things with the tied hash object
> that you may be used to doing with arrays, like Push(), Pop() and
> Splice().
>
> If you don't know what "tie" means, you should look at the
> perltie(1) manpage in a recent perl distribution, or in the
> index of one of the numerous books on perl.
>
Thanks a lot for your help. Tie::IxHash really works nicely for this type
of thing.
Cheers,
-Chenyang
------------------------------
Date: 10 Dec 1997 18:28:02 -0700
From: mfuhr@dimensional.com (Michael Fuhr)
Subject: Re: Returning information from an nslookup ??
Message-Id: <66nfj2$ooe@flatland.dimensional.com>
burt@ici.net (Burt Lewis) writes:
> As the original poster of this, I want to thank everyone who responded.
>
> I also am happy that it has been resolved for several weeks and the answer is
> below:
>
> @numbers = split(/\./, $ENV{'REMOTE_ADDR'}); # make 4-element array out of IP
> $ip_number = pack("C4", @numbers); # mangle
> ($i) = (gethostbyaddr($ip_number, 3))[0]; # and look up
Yuck.
use Socket;
$host = gethostbyaddr(inet_aton($ENV{"REMOTE_ADDR"}), AF_INET);
--
Michael Fuhr
http://www.dimensional.com/~mfuhr/
------------------------------
Date: Wed, 10 Dec 1997 17:40:28 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: David Baker <dbaker@dkburnap.com>
Subject: Re: simple array problem parsing a cookie
Message-Id: <Pine.GSO.3.96.971210172939.6051J-100000@user2.teleport.com>
On 10 Dec 1997, David Baker wrote:
> print "1. cookie as I got it: $cookie\n <br><br>";
This is a good debugging technique, to print out data at various points.
> (@variables) = $cookie;
So, at this point, @variables should be a one-element list.
> print "2. After assignment to array: @variables\n";
...which should print out.
> #SPLIT ON ; TO SEPERATE THE COOKIES
> for $a_variables (@variables){
> (@value) = split (/;/,$a_variables);
> }#END for
Now, if @variables had more than one item in it, you would have wiped out
and re-filled @value with each iteration. That's probably not what you
would have wanted - but since there's only one item in @variables, it's no
problem. (Although your code goes through lots of unnecessary work.) Now
@value should have one or more elements.
> print "<br><br> 3. After split on ; and value array assignment <br> value:
> @value <br> \n";
...and those should print out.
> #TAKE @value FROM ABOVE AND SPLIT ON =
> for (@value) {
> ($aname, $avalue) = split (/=/);
Now this assumes that there is only one equals sign in the item. (That's
probably a reasonable assumption in this case.)
> print "<br><br> 4.$test split on = for name/value assignment----- <br>
> name: $aname <br> value: $avalue <br> \n";
That should print them out.
> $thecookie{$aname} = $avalue; #POPULATE ASSOCIATIVE ARRAY
That should put an item into the hash. (Note that the %thecookie hash may
have already had items in it before this loop.)
> $test++; #INCREMENT COUNTER
> } #end for
> print "<br> <b> Step 4 </b> made $test passes populating the
> array.<br><br> \n";
>
>
> print "<br><br> 5. cookie after the array: <br> <b> asp:</b>
> $thecookie{'ASPSESSIONID'} <br> <b>id:</b> $thecookie{'id'} <br> \n ";
It may be that those particular keys weren't populated. I'd probably use
something like this to view the hash. (This assumes that the keys and
values don't contain anything that might mess up HTML markup.)
print "<br><br> 5. cookie hash: <ul>\n",
map("<li>$_: $thecookie{$_}\n", sort keys %thecookie),
"</ul>\n";
If you still can't see the trouble, there may be other characters (such as
control characters, or other non-printing characters) in either your keys
or values.
Hope this helps!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: Thu, 11 Dec 1997 02:06:02 GMT
From: ljwobker@eos.ncsu.edu (Lawrence J. Wobker)
Subject: sorting a hash of hashes???
Message-Id: <348f4a05.2001913@news.mindspring.com>
I'm looking for anyone who might be able to help me out with this one:
I have a hash or hashes, set up like so:
%USERDATA= ();
$USERDATA{$emailaddress}{current} = x;
$USERDATA{$emailaddress}{cumulative} = y;
this is repeated for a bunch of email addresses to populate the
hash/database. What I'm looking to do is sort the elements of the
hash by either the current or overall values. I can get them sorted
by email address, but haven't been able to get it done by the
secondary values. Any help is greatly appreciated.
thanks.
------------------------------
Date: Thu, 11 Dec 1997 02:07:11 GMT
From: ljwobker@eos.ncsu.edu (Lawrence J. Wobker)
Subject: Re: sorting a hash of hashes???
Message-Id: <348f4ab6.2179228@news.mindspring.com>
uh, oops. that should have been a hash OF hashes. damn typos.
>I'm looking for anyone who might be able to help me out with this one:
>
>I have a hash or hashes, set up like so:
>
>%USERDATA= ();
>$USERDATA{$emailaddress}{current} = x;
>$USERDATA{$emailaddress}{cumulative} = y;
>
>this is repeated for a bunch of email addresses to populate the
>hash/database. What I'm looking to do is sort the elements of the
>hash by either the current or overall values. I can get them sorted
>by email address, but haven't been able to get it done by the
>secondary values. Any help is greatly appreciated.
>
>thanks.
------------------------------
Date: Wed, 10 Dec 1997 18:08:25 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Steve <syarbrou@ais.net>
Subject: Re: Taking document in directories and replacing them dynamically
Message-Id: <Pine.GSO.3.96.971210180715.6051O-100000@user2.teleport.com>
On Wed, 10 Dec 1997, Steve wrote:
> I want an easy way where a preson hits any of the old pages on the old
> URL, it will redirect them directly to the new location of that
> document.
That's a server function. You may be able to get the information you need
from a newsgroup about servers, or (better) the appropriate docs and FAQs.
Good luck!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: Wed, 10 Dec 1997 17:21:28 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: John Porter <jdporter@min.net>
Subject: Re: There's More Than One Way?
Message-Id: <Pine.GSO.3.96.971210171919.6051F-100000@user2.teleport.com>
On Wed, 10 Dec 1997, John Porter wrote:
> Quoth Larry, "There's more than one way to do it", as we are all aware.
>
> This is interesting, philosophically, because it means that
> For every problem in the universe of problems,
> the number of solutions (in Perl) is >= 1.
> That is, there are no problems which can not be solved in Perl.
>
> Just a thought... :-)
Others have tried to find the flaw in this logic, but they've failed. It's
worth noting, however, that Larry didn't say that any of the ways to do it
are useful. For example, although there's more than one way to use Perl to
put a camel through the eye of a needle, none of them does the camel any
good. :-)
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: Wed, 10 Dec 1997 20:52:38 -0500
From: dowd-do-not-spam-me@no-spam.flash.net (Sean Dowd)
Subject: Re: Wanted: Perl5 script to scan+kill POP3 mailbox
Message-Id: <dowd-do-not-spam-me-1012972052380001@dasc16-46.flash.net>
In article <348ECB14.6383@ponder.demon.co.uk>, "A.M. Basman"
<amb26@ponder.demon.co.uk> wrote:
> I would like a nice script that, given username, password,
> POP3 server, and a file full of regexps, will run through
> the mailbox and trash any message whose From address
> matches any of the expressions.
>
> Yes, a spam filter.
>
> Does anyone have anything like this?
>
> No, I do not have the time/expertise to write one myself,
> at least, not one that I'd trust :)
Something like this should do it.
#!/usr/local/bin/perl
use Mail::POP3Client;
$pop = new Mail::POP3Client( 'user', 'password', 'host' ) || die "connect";
@regexs = <>;
for ( $i = 1; $i <= $pop->count(); $i++ ) {
foreach $h ( $pop->Head( $i ) ) {
foreach $re ( @regexs ) {
/$re/e && do {
$pop->delete( $i ); # to filter any header
last;
};
/^From: .*$re/e && do {
$pop->delete( $i ); # to only filter From
last;
};
}
}
}
$pop->close();
--
Remove nospam from the email address to reply.
------------------------------
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 1451
**************************************