[7155] in Perl-Users-Digest
Perl-Users Digest, Issue: 780 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jul 25 14:37:20 1997
Date: Fri, 25 Jul 97 11:00:22 -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, 25 Jul 1997 Volume: 8 Number: 780
Today's topics:
Agent that traces the URLs the user looks at (Calle ]sman)
Re: Array n dimensions <sfairey@adc.metrica.co.uk>
Re: Can't match = (Lack Mr G M)
Re: CGI.pm file uploads with Internet Explorer (Stu Holden)
Re: Delete a file <sfairey@adc.metrica.co.uk>
Getting the return code of `backquotes` commands or the <proulx@okiok.com>
Re: Getting the return code of `backquotes` commands or <sfairey@adc.metrica.co.uk>
Hash of arrays of arrays--newbie has ponweed for brains (Alex Hooper)
Re: Hash of arrays of arrays--newbie has ponweed for br <sfairey@adc.metrica.co.uk>
help on perl accessing database (Zhigang Xu)
Re: HELP: how to use an array passed to a function? <sfairey@adc.metrica.co.uk>
I need help with MIME::Entity (Ariel Y Fishman)
Is Perl 5.004 avaliable for Win NT 4 ? <serginho@alpha.hydra.com.br>
netware perl <franzj@email.uc.edu>
Re: Newbie seeks help for random calls (M.J.T. Guy)
Re: Passing references around (Chris Nandor)
Perl nomic <rmorganl@fred.fhcrc.org>
Perl script to serve up different HTML pages at differe (Gary Nielson)
Re: process handling (Alan Strassberg)
Re: python envy ? arw@lucent.com
Re: Q: associative arrays <sfairey@adc.metrica.co.uk>
Re: sending URLs <serginho@alpha.hydra.com.br>
Stuck On Socket Interaction <mwhite@csu.edu.au>
Re: turning off "<variable name> used only once" warnin (Tad McClellan)
XS: file handles <jheck@merck.com>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 25 Jul 1997 16:10:24 +0200
From: md4calle@md.chalmers.se (Calle ]sman)
Subject: Agent that traces the URLs the user looks at
Message-Id: <w7pd8o79q9b.fsf@grosse.mdstud.chalmers.se>
Hi, I wonder if someone know of any modules that can trace what the user
looks at.
E.g. the user starts some program before he starts browsing with netscape
and that program will dump all the URLs to the disc.
Does it exist? Does anyone have an idea how it can be done?
all best,
/Calle
------------------------------
Date: Fri, 25 Jul 1997 17:00:31 +0100
From: Simon Fairey <sfairey@adc.metrica.co.uk>
To: quelin@eret.cegelec-red.fr
Subject: Re: Array n dimensions
Message-Id: <33D8CD9F.360F2983@adc.metrica.co.uk>
Jerome Quelin wrote:
> Hi,
>
> How can I use (or simulate ?) array of n dimensions ?
> How can manipulate them ?
>
> Thanks,
> Jerome
> --
> Jerome Quelin
> email: quelin@eret.cegelec-red.fr
>
> -------------------==== Posted via Deja News
> ====-----------------------
> http://www.dejanews.com/ Search, Read, Post to Usenet
See the perldata, perldsc and perllol manpages, also look at the FAQ
at http://www.perl.com/FAQ.
Simon
------------------------------
Date: Fri, 25 Jul 1997 17:36:10 BST
From: gml4410@ggr.co.uk (Lack Mr G M)
Subject: Re: Can't match =
Message-Id: <1997Jul25.173610@ukwit01>
In article <5r3fbf$mst$1@d2.tufts.edu>, rdorich@allegro.cs.tufts.edu (Roberto L. Dorich) writes:
|> Hi netters,
|>
|> I'm trying to process all the lines in a file with the following format:
|>
|> SOME_ID = some_num,
|> ^--- the , is optional.
|>
|> So I do:
|>
|> while ($line = <file>)
|> {
|> next if ($line =~ /\w+\b*=/);
|>
|> process($line);
|> }
Two bugs in your regexp line....
1) Since you wish to process lines which match the regexp, you shouldn't
be skiiping them with a next!!!
2) Since your example has *whitespace* between the first token and the
'=' you shouldn't be looking for a word-boundary. Indeed the * in \b* is
redundant. Since a word-boundary has zero-width (its a condition rather
than matching a character) it is either there or it isn't!
Try reversing the logic and checking for whitespace with:
next if ($line !~ /\w+\s*=/);
(Of course, you could use grouping to parse the line at the same time...).
--
----------- Gordon Lack ----------------- gml4410@ggr.co.uk ------------
The contents of this message *may* reflect my personal opinion. They are
*not* intended to reflect those of my employer, or anyone else.
------------------------------
Date: Fri, 25 Jul 1997 12:01:08 GMT
From: stu@icl.net (Stu Holden)
Subject: Re: CGI.pm file uploads with Internet Explorer
Message-Id: <33d89525.7471832@news1.news.iclnet.co.uk>
>: Does anyone know if there is an easy way to do file uploads with
>: Internet Explorer? CGI.pm makes file uploads really easy assuming that
>: you are using netscape 2.0 or better, but I have seen nothing similar
>: for Internat Explorer.
>
>Internet Explorer (all versions, including the new 4.0 betas) does not
>support HTTP-based file upload from the browser. This is something that is
>supported by other browsers, and there is an RFC out for it (cannot
>remember the number right off hand), but it has never supported this
>feature.
I may have got the wrong end of the stick, but if you are refering to
the <INPUT="file".....> stuff, then IE3.2 supports it, and there is a
plugin available from MS site for v4.
------------------------------
Date: Fri, 25 Jul 1997 17:05:55 +0100
From: Simon Fairey <sfairey@adc.metrica.co.uk>
To: Peter Kolonelos <pkolonel@mnsi.net>
Subject: Re: Delete a file
Message-Id: <33D8CED7.585D2CF5@adc.metrica.co.uk>
Peter Kolonelos wrote:
> I have written a perl/cgi script but I need help with the following:
>
> The script constructs an html file with frames. In one of the frames,
> I need
> to modify the html file independently. For example, frame1 contains
> top.htm,
> frame2 contains left.htm, etc.
>
> I want to check top.htm if it is empty. If it is NOT empty, I want to
> delete
> the file and then create a new file with the same name with new
> contents
> generated by my script. Is this possible?
>
Sure is.
> Any help would be greatly appreciated.
Try:
$filename = 'top.htm';
if( -s $filename ) {
open FILE, ">$filename" or die "Unable to open $filename: $!";
print FILE "\nStick whatever you want in the file";
close FILE;
}
There is no need to delete the file if it contains data as it will be
recreated when you open it.
Simon
------------------------------
Date: Fri, 25 Jul 1997 11:05:27 -0400
From: Martin Proulx <proulx@okiok.com>
Subject: Getting the return code of `backquotes` commands or the output of system commads.
Message-Id: <33D8C0B7.5FEE@okiok.com>
Hello!
I have a CGI script where I lunch some external process, so evidently, I
do not want the output of this external process to mix in with my CGI
script's STDOUT.
So, I have been using `backquotes` to launch this external process,
unfortunately I haven't found a way to get the return code of the
launched process in this way.
Does anyone know how to get that return code?
Thanks!
Martin Proulx
Okiok Data
------------------------------
Date: Fri, 25 Jul 1997 18:30:55 +0100
From: Simon Fairey <sfairey@adc.metrica.co.uk>
To: Martin Proulx <proulx@okiok.com>
Subject: Re: Getting the return code of `backquotes` commands or the output of system commads.
Message-Id: <33D8E2CF.15FF7937@adc.metrica.co.uk>
Martin Proulx wrote:
> Hello!
>
> I have a CGI script where I lunch some external process, so evidently,
> I
> do not want the output of this external process to mix in with my CGI
> script's STDOUT.
>
> So, I have been using `backquotes` to launch this external process,
> unfortunately I haven't found a way to get the return code of the
> launched process in this way.
>
> Does anyone know how to get that return code?
>
> Thanks!
>
> Martin Proulx
> Okiok Data
The variable '$?' should hold the value of the last `COMMAND`, pipe
close or system() command executed.
Simon
------------------------------
Date: Fri, 25 Jul 1997 17:14:39 +0000
From: oops@cryogen.com (Alex Hooper)
Subject: Hash of arrays of arrays--newbie has ponweed for brains
Message-Id: <19970725171439171904@hipps.demon.co.uk>
Hello,
I'm trying to build what I thought would be a fairly simple data
structure: a hash of arrays of arrays. I want to read in a tab
delimitted text file a bit like this:
cat1 item1 price1 desc1
cat1 item2 price2 desc2
cat2 item1 price1 desc1
cat2 item2 price2 desc2
...
Each line becomes an array of length 4; each array is added to another
array until the category changes (eg, from 'cat1' to 'cat2'), at which
point, this array is added to a hash with a key equalling the category
name (eg, 'cat1').
Simple, I thought. And simple was certainly the way I felt by 4am,
having failed miserably at every turn. Reading the perlref man page only
made me feel more stupid. It must be the way it's written (ahem).
I present below the ugly spaghetti-like mess I've arrived at. It works,
clunkilly, up to a point; the first big problem is the line:
@catalogue{$currentCat} = \@$temp;
which only picks up the last category array (eg, 'cat2')
the second big problem is my trying to retrieve the arrays out of the
hash, and iterate through them.
I'd be extremely grateful if anybody could give me any pointers.
Sorry for my cotton-wool-headed explanations...
Alex
open (UPDATE, 'update.txt');
@tempArray = ();
$currentCat = "";
$j = 0;
$w = 0;
while (<UPDATE>) {
chomp;
$count = "thisEntry$w$j";
@$count = split /\t/;
$temp = "temp$w";
$currentCat = $$count[0] if $currentCat eq "";
$$temp[$j] = \@$count;
if ($$count[0] eq $currentCat) {
$j ++;
next;
}
@catalogue{$currentCat} = \@$temp;
$j = 0;
$w ++;
$currentCat = $$count[0]
}
@catalogue{$currentCat} = \@$temp;
$alex = "";
@finally = values %catalogue;
$finalLen = @finally;
for ($f = 0; $f < $finalLen; $f ++) {
@innerArray = $finally[$f];
$innerLen = @innerArray;
for ($in = 0;$in <= $innerLen; $in ++) {
$hey = $innerArray[0];
@heyArray = $innerArray[0];
$alex .= "$innerArray[$in][0] $innerArray[$in][1]
$innerArray[$in][2] $innerArray[$in][3] endOfForeach\n";
print "$innerArray[$in][0] $innerArray[$in][1]
$innerArray[$in][2] $innerArray[$in][3] endOfForeach
";
}
}
------------------------------
Date: Fri, 25 Jul 1997 18:28:29 +0100
From: Simon Fairey <sfairey@adc.metrica.co.uk>
To: Alex Hooper <oops@cryogen.com>
Subject: Re: Hash of arrays of arrays--newbie has ponweed for brains
Message-Id: <33D8E23C.175F61E7@adc.metrica.co.uk>
Alex Hooper wrote:
> Hello,
>
> I'm trying to build what I thought would be a fairly simple data
> structure: a hash of arrays of arrays. I want to read in a tab
> delimitted text file a bit like this:
>
> cat1 item1 price1 desc1
> cat1 item2 price2 desc2
> cat2 item1 price1 desc1
> cat2 item2 price2 desc2
> ...
>
> Each line becomes an array of length 4; each array is added to another
>
> array until the category changes (eg, from 'cat1' to 'cat2'), at which
>
> point, this array is added to a hash with a key equalling the category
>
> name (eg, 'cat1').
>
> Simple, I thought. And simple was certainly the way I felt by 4am,
> having failed miserably at every turn. Reading the perlref man page
> only
> made me feel more stupid. It must be the way it's written (ahem).
>
> I present below the ugly spaghetti-like mess I've arrived at. It
> works,
> clunkilly, up to a point; the first big problem is the line:
>
> @catalogue{$currentCat} = \@$temp;
>
> which only picks up the last category array (eg, 'cat2')
>
> the second big problem is my trying to retrieve the arrays out of the
> hash, and iterate through them.
>
> I'd be extremely grateful if anybody could give me any pointers.
>
> Sorry for my cotton-wool-headed explanations...
>
> Alex
>
> open (UPDATE, 'update.txt');
>
> @tempArray = ();
> $currentCat = "";
> $j = 0;
> $w = 0;
>
> while (<UPDATE>) {
>
> chomp;
> $count = "thisEntry$w$j";
> @$count = split /\t/;
> $temp = "temp$w";
> $currentCat = $$count[0] if $currentCat eq "";
> $$temp[$j] = \@$count;
> if ($$count[0] eq $currentCat) {
> $j ++;
> next;
> }
>
> @catalogue{$currentCat} = \@$temp;
> $j = 0;
> $w ++;
> $currentCat = $$count[0]
> }
>
> @catalogue{$currentCat} = \@$temp;
>
> $alex = "";
>
> @finally = values %catalogue;
> $finalLen = @finally;
>
> for ($f = 0; $f < $finalLen; $f ++) {
>
> @innerArray = $finally[$f];
> $innerLen = @innerArray;
> for ($in = 0;$in <= $innerLen; $in ++) {
> $hey = $innerArray[0];
> @heyArray = $innerArray[0];
> $alex .= "$innerArray[$in][0] $innerArray[$in][1]
> $innerArray[$in][2] $innerArray[$in][3] endOfForeach\n";
> print "$innerArray[$in][0] $innerArray[$in][1]
> $innerArray[$in][2] $innerArray[$in][3] endOfForeach
> ";
> }
> }
Read the perllol manpage, it has some great examples, if you are still
stuck after reading that then let me know.
Simon
------------------------------
Date: 25 Jul 1997 16:12:24 GMT
From: zhigangx@lab41.eng.auburn.edu (Zhigang Xu)
Subject: help on perl accessing database
Message-Id: <5raj98$n7f@ultranews.duc.auburn.edu>
The email address in my last message I post here is wrong.
It shoul be zhigangx@eng.auburn.edu.
Here are the questions that I seek for help
I installed Perl on Linux. I would like how I can use perl to access
database. There are several database modules at/usr/lib/perl5, such as
DB_File.pm, SDBM_File.pm ... How can I can use these module to assess
database? How can create database tables? Do I need a database server
engine on Linux such as mSQL, Is there any interface availiabe between
Perl and mSQL.
Please reply to zhigangx@eng.auburn.edu
Thanks
Richard
------------------------------
Date: Fri, 25 Jul 1997 17:30:02 +0100
From: Simon Fairey <sfairey@adc.metrica.co.uk>
To: tbrannon <tbrannon@nunki.usc.edu>
Subject: Re: HELP: how to use an array passed to a function?
Message-Id: <33D8D489.B85BFB03@adc.metrica.co.uk>
tbrannon wrote:
> I would like $gmax to iterate over each value in the array passed in
> as the first argument to this function. The function is called as
> follows:
>
> @ary=(1,2,3)
> multi_gmax(@ary,0,999)
Try:
multi_gmax( 0, 999, @ary );
Combined wth the function below or look into references ( the best way
to solve this problem ) in the perlref man pages, and also see the FAQ
as to why you will get problems combining scalars and arrays in function
calls.
> sub multi_gmax (\@$$) {
> my $gmax;
> print "\$_[0]: ", $_[0], $/;
> print "\$_[1]: ", $_[1], $/;
> foreach $gmax ($_[0]) {
> print "Working with: ", $gmax, $/;
> # single_line($gmax, $_[1], $_[2]);
> }
> }
>
Then change the above to:sub multi_gmax {
my( $low, $high, @array ) = @_;
my $gmax;
foreach $gmax ( @array ) {
print "\nWorking with : $gmax";
}
}
This should get you started I hope.
Simon
------------------------------
Date: 24 Jul 1997 01:11:29 GMT
From: ayfishma@mail2.sas.upenn.edu (Ariel Y Fishman)
Subject: I need help with MIME::Entity
Message-Id: <5r6a41$v90$1@netnews.upenn.edu>
I am trying to work with the MIME-tools module which I downloaded from
CPAN, but I am having a difficult time in its implementation.
Specifically, I tried to use the mimesend.pl file included in the
examples for MIME-tools-3.204 and others I'm sure. It instructs that I
type something to the effect of
mimesend <-t to> <-s subject> (-f <file> <type>)+
but, despite parsing the rest of the command OK, "mimesend" itself is not
recognized as a command.
Am I doing something terribly naive here? Has anyone faced a similar
problem?
Thanks in advance,
Ariel
-----------------------------
Ariel Fishman fishman@pobox.com
------------------------------
Date: 25 Jul 1997 16:09:41 GMT
From: "Sergio Stateri Jr" <serginho@alpha.hydra.com.br>
Subject: Is Perl 5.004 avaliable for Win NT 4 ?
Message-Id: <01bc9915$876a8800$ca75e7c8@Term104>
Is Perl 5.004 avaliable for Win NT 4 ?
Thanks,
--
--------------------------------------------
Sergio Stateri Jr
Sco Paulo (SP) - Brazil
e-mail: serginho@mail.serve.com
--------------------------------------------
------------------------------
Date: Fri, 25 Jul 1997 12:03:11 -0400
From: void <franzj@email.uc.edu>
Subject: netware perl
Message-Id: <33D8CE3F.AEAB0661@email.uc.edu>
hello, excuse me if this has been adressed before - i'm fairly new to
the newsgroup...
i downloaded the compiled version of perl4 from cpan, for netware at the
request of my boss.. unfortunatly this version has No documentation with
it, for instalation or netware-specific commands...
i'm very familar with perl4 itself on unix and win32 systems due to the
cgi scripts i edit/write for my current job, but now we're looking at
moving to using perl for some network admin functions on the netware
server and other than doing system calls at the netware prompt i'm not
sure what perl can do for us (although it'll still be better than the
old dos based batch files the department has used before!) - if anyone
has any experience with running/installing/using perl4 on a netware
server, please contact me so i can borrow your brain for a few days.. or
at least ask a few questions <g>.
sorry if this is spam, have a good day.
~Jon (that guy)
------------------------------
Date: 25 Jul 1997 15:57:58 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Newbie seeks help for random calls
Message-Id: <5raie6$6qd@lyra.csx.cam.ac.uk>
Alan J. Flavell <flavell@mail.cern.ch> wrote:
>
>I remember one of our students being entirely baffled that
>every time he ran his program that involved "rand", it produced
>the same answer. This isn't random at all, said he.
>
>So we told him about srand. Since this thread is avowedly about
>newbies, I thought one might mention that.
Your student wasn't the only one baffled. So as from Perl5.004, srand()
is called automatically if the user hasn't already done it. So except
for very special purposes and/or backward compatibility, user calling of
srand is obsolete.
So you don't need to mention it after all if you've got an up-to-date Perl.
Mike Guy
------------------------------
Date: Fri, 25 Jul 1997 11:52:37 -0500
From: pudge@pobox.com (Chris Nandor)
Subject: Re: Passing references around
Message-Id: <pudge-ya02408000R2507971152370001@news.idt.net>
In article <01bc9736$d5b3f4a0$3f94e5cf@nedmondson>, "Neil Edmondson"
<neiled@enteract.com> wrote:
# The following snippet works. What I would like to do is use a scalar (the
# additional path_info passed by CGI), to reference the hash. The scalar
# will contain the value "fabric" e.g. $path_info = "fabric". How do I write
# the code to turn $themeref into a reference to %fabric based on the value
# of $path_info?
It's easier than you think. However, this cannot work when "use strict"
(makes you think that doing it this way might not be a good idea :-).
#!perl
$path_info = "fabric";
%fabric = (
"Garden Splendor", "1",
"Market Day Plaid", "2",
"Classic Blue", "3",
"Heritage Green", "4",
"Traditional Red", "5",
"Natural", "6",
"Holly", "7",
"Imperial Stripe", "8",
"Rose Trellis", "9",
"Emerald Vine", "10");
$themeref = $path_info;
foreach $key (sort keys %$themeref) {
print $key, '|', $$themeref{$key}, "|0|0\n";
}
--
Chris Nandor pudge@pobox.com http://pudge.net/
%PGPKey=('B76E72AD',[1024,'0824 090B CE73 CA10 1FF7 7F13 8180 B6B6'])
------------------------------
Date: Fri, 25 Jul 1997 10:24:22 -0700
From: Ross Morgan-Linial <rmorganl@fred.fhcrc.org>
Subject: Perl nomic
Message-Id: <Pine.GSO.3.95.970725101609.11378G-100000@fred>
I've set up an interesting perl program called PerlNomic. It's a
self-modifying perl script based on the game of Nomic. Basically, players
can send it proposals and vote on them, and if they pass, they modify the
perl script. The whole thing is run in a Safe module, to give me a feeling
of security :-)
If you want more information, source code, or to become a player, send me
email. Unfortunately, I don't read this newsgroup regularly, so send
replies directly to me or I'll probably miss them. If you want to find out
more about the game of Nomic, read the Nomic FAQ at
http://www.cse.unsw.edu.ad/~malcolmr/nomic-faq.html
Ross Morgan-Linial * rmorganl@fhcrc.org
------------------------------
Date: Fri, 25 Jul 97 15:26:01 GMT
From: gnielson@charlotte.infi.net (Gary Nielson)
Subject: Perl script to serve up different HTML pages at different times of day
Message-Id: <5ragj6$1qo$1@nw001.infi.net>
I am looking for a perl script that can, depending on the time of day, take
the user to a different HTML page. Does anyone know of such a script and
where I might find it? Any help much appreciated.
Gary Nielson
------------------------------
Date: 25 Jul 1997 09:30:38 -0700
From: alan@bali.seg.wj.com (Alan Strassberg)
Subject: Re: process handling
Message-Id: <5rakbe$pu@bali.seg.wj.com>
[checking if a process is already runing]
In article <lzk9ikl2b2.fsf@universe.pc.helsinki.fi>,
Matti Kinnunen <matti@universe.pc.helsinki.fi> wrote:
>
>what do you think about:
>
>{
>open(SYS, "ps -ax| grep prog_to_check| grep -v grep |");
>my($tmp) = <SYS>;
>close <SYS>;
>system ('prog_to_re-invoke') if ($tmp ne "");
>
>}
There's two gotchas with this technique:
1. assumes the process is in the ps table (ok, that was a given)
2. the command name could be an argument to another command
(or even in the name of the script!).
I learned (thanks Tom Phoenix!) when the PID is known, that
"kill 0" returns 1 if process is running, and 0 if not. Unfortunately
this doesn't work on all systems. It does for me so here's
what my solution looks like:
#!/usr/local/bin/perl -w
# check if a process is running, and restart if not
# given the PID, "kill 0, PID" returns 1 if process is running, 0 if not.
# doesn't work on all systems
$IsRunning = 0; # assume not running
$PID = 0;
$PIDFILE = "/u1/squid/logs/squid.pid";
if (-e $PIDFILE) { $PID = `cat $PIDFILE`; }
if ($PID) {
$IsRunning = kill 0, $PID
or die "inadequate permissions to kill process $PID $!\n\n" ;
}
if ( ! $IsRunning ) { # restart
($> == 0) or die "must be root to restart process $!\n";
system ('/u1/squid/bin/squid &');
print "\nrestarting squid ....\n\n";
}
alan
--
alan@wj.com
------------------------------
Date: Fri, 25 Jul 1997 12:52:44 -0600
From: arw@lucent.com
Subject: Re: python envy ?
Message-Id: <869852242.361@dejanews.com>
In article <5r82ju$css$1@argo.hks.com>,
dumes@nospam.hks.com wrote:
>
> What seems funny to me, though, is that in my studies, I see the python
> groups constantly comparing python to perl to show why python is the one
> and true scripting language, but I rarely see perl afficianos saying that
> anything python can do, perl can do better.
I think that's a bit of an exaggeration, but there's a hint of truth.
Well, that's because we get a lot of people saying "I'm moving
from using Perl to Python and I don't know how to do what this
fragment of Perl does", to which we often respond "we can't read
that, could you describe what you are trying to do in some other way?"
:). Then we demonstrate the right way to do it (which uses Python,
of course). We also get a lot of questions like "Why python instead
of perl?" What do you expect?
There is some reason to be envious of Perl -- you guys got a lot
of books and a lot of hot libraries and one hell of a good network
of professionals that field newbie questions, regular columns in
professional magazines, etcetera. Many people I meet have heard
of Perl, but haven't heard of Python (or not enough to know what it
is). This does breed a certain defensiveness in the Python community,
especially when we are regularly flamed by Perlers.
Some of the messages you refer to may also be from recent
converts with former Perl experience, who tend to be quite
enthusiastic (and not terribly diplomatic, unlike most computer
professionals ;c) ).
> The general feeling I get is that the perl community says there's a place
> for both.
And who can argue with that? But if you asked me why I prefer
Python, for larger, more complex problems, well, I'm going to tell you.
[Perl beats Python for many simple text processing tasks tho,
at least if you know it well enough.]
Please bear in mind that (as reported by certain perlers) I'm a man
of very little self esteem with no professional integrity, bitter
in my losing cause, etcetera, etcetera, so disregard anything I say. :)
-- Aaron Watters (http://starship.skyport.net/crew/aaron_watters)
===
Pay no attention to the man behind the curtain!
-------------------==== Posted via Deja News ====-----------------------
http://www.dejanews.com/ Search, Read, Post to Usenet
------------------------------
Date: Fri, 25 Jul 1997 16:59:10 +0100
From: Simon Fairey <sfairey@adc.metrica.co.uk>
To: Uwe Lammers <Uwe.Lammers@astro.estec.esa.nl>
Subject: Re: Q: associative arrays
Message-Id: <33D8CD4E.82A41DD1@adc.metrica.co.uk>
Uwe Lammers wrote:
> Hi,
>
> another newbie question: Is there a way to force Perl to iterate over
> the elements in an associative array in the order as it was given in
> the array definition?
> Example:
>
> %dum = ( '3', '3', '1', '1', '2', '2' );
>
> while (($key, $val) = each(%dum)) {
> print "$key/$val\n";
> }
>
> This prints (not surprisingly):
> 1/1
> 2/2
> 3/3
>
> but I want to see;
>
> 3/3
> 1/1
> 2/2
>
> You may ask why I do not use normal arrays but I have good reasons not
>
> to do so ...
>
> Cheers
> Uwe. (ulammers@astro.estec.esa.nl)
From the FAQ ( http://www.perl.com/FAQ ):
Q. How can I make my hash remember the order I put elements into it.
A. Use the Tie::IxHash ( module ) from CPAN ( http://www.perl.com/CPAN )
I haven't used this myself so I don't know anything about it but this
should get you started.
Simon
------------------------------
Date: 25 Jul 1997 13:52:37 GMT
From: "Sergio Stateri Jr" <serginho@alpha.hydra.com.br>
Subject: Re: sending URLs
Message-Id: <01bc9902$6cb33740$ca75e7c8@Term104>
Clare Ferry <cferry@cs.strath.ac.uk> escreveu no artigo
<33D88477.4551@cs.strath.ac.uk>...
> hi
> i was wondering if anyone has examples of a perl script that can receive
> or send urls???
> thanks
> cferry@cs.strath.ac.uk
>
Take Perl INet Module at CPAN..
--
--------------------------------------------
Sergio Stateri Jr
Sco Paulo (SP) - Brazil
e-mail: serginho@mail.serve.com
--------------------------------------------
------------------------------
Date: Fri, 25 Jul 1997 19:07:23 +1000
From: Matthew White <mwhite@csu.edu.au>
Subject: Stuck On Socket Interaction
Message-Id: <33D86CCB.B69BF349@csu.edu.au>
I have been using sockets for a little while and have no trouble having
two way conversations where only one line is involved. However, if
either the client or server wants to send multiple lines, the other
dosen't seem to know when (if ever) the incoming data will finish. I'm
reading and writing using print and <> (not argv) both autoflushed.
Eg:
<Client Code>
chop($in=<S>);
print S "hello\n";
chop($in=<s>);
...
<Server Code>
print C "Hello There\n";
chop($in=<C>);
print C "How's the Weather etc..\n";
...
This all works fine.
As soon as I put something like this into the conversation it hangs
<Client Code>
while (<S>) {
$x .= $_;
}
print S "I got it\n";
<Server Code>
print C <<MULTILINE;
here is the
stuff I am sending you
MULTILINE
chop($well=<C>)
I've tried sending a ctrl-D at the end of the string but that didn't
work. How do I tell the client to "stop waiting for info and get on with
the conversation, all has been said!". All the usual filehandle tricks
don't seem to be working (such as undefing $/).
Thanks
Matthew
------------------------------
Date: Thu, 24 Jul 1997 16:38:01 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: turning off "<variable name> used only once" warning
Message-Id: <pvh8r5.sqd.ln@localhost>
+jeff (gt5146c@acmez.gatech.edu) wrote:
: I've looked every I can think of but can't seem to figure out
: how to do this, any ideas?
^^^^^^^^^
Yes. Use each variable either 1) zero times or
2) more than one time ;-)
Understanding why it is complaining would be a good idea too.
You should be looking for a way to _avoid_ the warning rather than
a way to disable the warning. We can't help you with how to avoid
the warning in your particular case because we don't have any of
your code (hint, hint)...
--
Tad McClellan SGML Consulting
Tag And Document Consulting Perl programming
tadmc@flash.net
------------------------------
Date: Fri, 25 Jul 1997 12:15:00 -0400
From: "James J. Heck" <jheck@merck.com>
Subject: XS: file handles
Message-Id: <33D8D104.41C6@merck.com>
I am trying to pass a name to a PERL script that it will use as an
output file. If I dont pass a name I would like to just use STDOUT.
however, the C program that PERL then calls expects a FILE * that is
already available, ie open.
I have tried the following to now avail:
open(OFILE, "STDOUT");
open(OFILE, ">STDOUT");
open(OFILE, >STDOUT);
Any help would be great.
James
--------------------
James J. Heck
jheck@acm.org
http://www.bucknell.edu/~jheck
The contents of this message express only the sender's opinion.
This message does not necessarily reflect the policy or views of
my employer, Merck & Co., Inc. All responsibility for the statements
made in this Usenet posting resides solely and completely with the
sender.
------------------------------
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 780
*************************************