[9437] in Perl-Users-Digest
Perl-Users Digest, Issue: 3032 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jun 30 19:07:30 1998
Date: Tue, 30 Jun 98 16:00:29 -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, 30 Jun 1998 Volume: 8 Number: 3032
Today's topics:
Re: Arrays (Keith L. Miller)
Re: Arrays <sjohns17@uic.edu>
Re: Arrays (Larry Rosler)
Re: change directory in perl (Craig Berry)
Re: change key in hash (Craig Berry)
Re: Couple of quick ?'s from perl newbie <rootbeer@teleport.com>
Re: Couple of quick ?'s from perl newbie cia1@ix.netcom.com
Re: Couple of quick ?'s from perl newbie (Craig Berry)
Re: Exit status from system() not what I expected (and (Charles DeRykus)
Finding the FAQ (was: Re: Arrays) <rootbeer@teleport.com>
Re: Flames.... (I R A Aggie)
Re: Help needed! <rootbeer@teleport.com>
HTML Form value problem <gavery@uu.net>
Re: HTML Form value problem <rick.delaney@shaw.wave.ca>
http client file download? s123@ptd.net
Re: i've got a forking problem <*@qz.to>
Re: i've got a forking problem (Dan Perez)
Re: i've got a forking problem <tchrist@mox.perl.com>
Re: i've got a forking problem <tchrist@mox.perl.com>
Re: Java and Perl together? (Thomas Wernitz)
Re: Java and Perl together? (Albert W. Dorrington)
Re: Newbie sort print question <alf@orion.it>
PerlScript Arrays (Brent Johnson)
Re: PerlScript Arrays (Brent Johnson)
Re: PUZZLE: dutree (old) (Michael J Assels)
Re: PUZZLE: dutree (old) <tchrist@mox.perl.com>
Re: Randomize number between -0.5 and 0.5 (Keith Thompson)
Re: rename() not working ...any ideas? <rootbeer@teleport.com>
Re: rename() not working ...any ideas? (Ilya Zakharevich)
Re: timelocal function in 2000 <rootbeer@teleport.com>
Re: What a Crappy World (Craig Berry)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 30 Jun 1998 21:01:06 GMT
From: miller@bigsky.net (Keith L. Miller)
Subject: Re: Arrays
Message-Id: <359951fe.27207113@news.bigsky.net>
Where is this Perl FAQ 4 at?
On Tue, 30 Jun 1998 13:23:18 -0700, lr@hpl.hp.com (Larry Rosler)
wrote:
>In article <35993f23.22379593@news.bigsky.net> on Tue, 30 Jun 1998
>19:42:54 GMT, Keith L. Miller <miller@bigsky.net> says...
>> I have an array, lets say:
>>
>> @ports=(15,17);
>>
>> now, I want to be able to compare every element of the array in an if
>> statement such asL
>>
>> if ($test eq "temp" && $test2 == ??????){
>>
>>
>> Now, what do I put where the ?'s are so that it will make the
>> comparison to every element in tie @ports array?
>
>Read perlfaq4: "How can I tell whether an array contains a certain
>element?"
>
>--
>Larry Rosler
>Hewlett-Packard Laboratories
>http://www.hpl.hp.com/personal/Larry_Rosler/
>lr@hpl.hp.com
------------------------------
Date: Tue, 30 Jun 1998 15:32:20 -0500
From: Seth David Johnson <sjohns17@uic.edu>
Subject: Re: Arrays
Message-Id: <Pine.SOL.3.96.980630152739.22800A-100000@icarus.cc.uic.edu>
On Tue, 30 Jun 1998, Keith L. Miller wrote:
> I have an array, lets say:
>
> @ports=(15,17);
>
> now, I want to be able to compare every element of the array in an if
> statement such asL
>
> if ($test eq "temp" && $test2 == ??????){
>
>
> Now, what do I put where the ?'s are so that it will make the
> comparison to every element in tie @ports array?
I usually do something like this:
$n = 0;
while ( $n < @ports ) {
if ( something_about $ports[$n] ) { do_something }
++$n;
}
@ports, in a scalar context, is equal to the number of elements in that
array. $ports[$n] is the $nth element in the array.
If I am answering something which is simpler then you're asking, I'm
sorry; I think this is what you were looking for, tho...
-Seth Johnson
Student/Programmer of Perl
------------------------------
Date: Tue, 30 Jun 1998 14:22:56 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Arrays
Message-Id: <MPG.1002f70ef463eba49896db@nntp.hpl.hp.com>
[This followup was posted to comp.lang.perl.misc and a copy was sent to
the cited author.]
In article <359951fe.27207113@news.bigsky.net> on Tue, 30 Jun 1998
21:01:06 GMT, Keith L. Miller <miller@bigsky.net> says...
> Where is this Perl FAQ 4 at?
The Perl FAQs are included with the standard perl distribtion, and are
available on the web from the Source of All Perl Knowledge:
http://www.perl.com/CPAN-
local/doc/FAQs/FAQ/PerlFAQ.html#How_can_I_tel_whether_an_aray_
Everyone should scan the questions before submitting to this newsgroup.
--
Larry Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 30 Jun 1998 21:20:49 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: change directory in perl
Message-Id: <6nbkrh$8ji$3@marina.cinenet.net>
waikei@my-dejanews.com wrote:
: I want to write a script which is used to change the working
: directory. The problem is: After the script run, the working
: dir. is back to the original dir. but actually I want to stay
: in the new working directory. I change the dir. by the function
: chdir. Could anyone kindly give me some hints?
Asking it twice only makes it that much more Frequently Asked. :) Check
the FAQ (perlfaq8, to be precise). Short answer: Can't be done.
---------------------------------------------------------------------
| Craig Berry - cberry@cinenet.net
--*-- Home Page: http://www.cinenet.net/users/cberry/home.html
| Member of The HTML Writers Guild: http://www.hwg.org/
"Every man and every woman is a star."
------------------------------
Date: 30 Jun 1998 21:01:54 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: change key in hash
Message-Id: <6nbjo2$8ji$2@marina.cinenet.net>
gunnar.djurberg@front.se wrote:
: Let's say I detect an incorrect key in a large hash. Is there a way to change
: just that key, without creating the entire hash anew?
Do you mean just delete the key (and its associated value) from the hash?
'perldoc -f delete'. If you want to change a key's name while retaining
its value,
$h{newname} = delete $h{oldname};
does the job.
: Also I would like to know if there are ways to "cast" hashes to arrays. (I
: know that it is possible to write %hash = @arr;)
@arr = %hash;
Following this, @array will be ( keyX, valX, keyY, valY, ... ). The pairs
will be in no meaningful order.
---------------------------------------------------------------------
| Craig Berry - cberry@cinenet.net
--*-- Home Page: http://www.cinenet.net/users/cberry/home.html
| Member of The HTML Writers Guild: http://www.hwg.org/
"Every man and every woman is a star."
------------------------------
Date: Tue, 30 Jun 1998 20:29:47 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Couple of quick ?'s from perl newbie
Message-Id: <Pine.GSO.3.96.980630130307.15737I-100000@user2.teleport.com>
On Tue, 30 Jun 1998 cia1@ix.netcom.com wrote:
> Subject: Couple of quick ?'s from perl newbie
Please check out this helpful information on choosing good subject
lines. It will be a big help to you in making it more likely that your
requests will be answered.
http://www.perl.com/CPAN/authors/Dean_Roehrich/subjects.post
> ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11)=split(/|/);
$1 and friends are read-only. Doesn't Perl point this out when you try to
run your program? Also, the vertical bar is a pattern metacharacter; you
must want to backwhack it.
> open (DB, "data.txt");
Even when your script is "just an example" (and perhaps especially in that
case!) you should _always_ check the return value after opening a file.
> while <DB> {
Please don't post code until you've done your best to get it to work.
This isn't even syntactically correct.
> print DB;
This isn't what you want.
> close <DB>;
<rocky> That trick _never_ works! </rocky>
> It prints a little strange
No, it doesn't. You can't just make up syntax, claim that your code is
only "a little" buggy, and get much respect around here. This is like
asking a car mechanic to take a look at your car, but you only brought in
a pair of fuzzy dice and a half-empty jar of Turtle Wax. :-)
You should get the Llama book and start working through the
exercises. Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Tue, 30 Jun 1998 21:23:23 GMT
From: cia1@ix.netcom.com
Subject: Re: Couple of quick ?'s from perl newbie
Message-Id: <6nbl0c$1pm$1@nnrp1.dejanews.com>
Thanks to those who replied! I now know you can't use $1, etc.. as scalers.
I renamed the scalers and everything works and I can move on to the next
step. I also now know that I was sloppy in my post by leaving out ()'s around
the Filehandle.
Thanks agian,
Dave
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: 30 Jun 1998 22:04:40 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Couple of quick ?'s from perl newbie
Message-Id: <6nbndo$8ji$4@marina.cinenet.net>
cia1@ix.netcom.com wrote:
[snip]
: print DB "$FORM{'name'}|$FORM{'email'}|$FORM{'phone'}|$FORM{'room'}|
: $FORM{'month'}|$FORM{'day'}|$FORM{'year'}|$FORM{'from'}|$FORM{'ampm'}|
: $FORM{'to'}|$FORM{'ampm2'}\n";
[snip]
It's often easier to write multi-hash-field concatenations such as yours
like this:
my @outfields = qw( name email phone room month day year
from ampm to ampm2 );
print DB join('|', @FORM{@outfields}), "\n";
Both easier to type and a *whole* lot easier to maintain.
---------------------------------------------------------------------
| Craig Berry - cberry@cinenet.net
--*-- Home Page: http://www.cinenet.net/users/cberry/home.html
| Member of The HTML Writers Guild: http://www.hwg.org/
"Every man and every woman is a star."
------------------------------
Date: Tue, 30 Jun 1998 20:34:46 GMT
From: ced@bcstec.ca.boeing.com (Charles DeRykus)
Subject: Re: Exit status from system() not what I expected (and other doc probs)
Message-Id: <EvDt5y.EuJ@news.boeing.com>
In article <r867hlghb9.fsf@asc.sps.mot.com>,
Martin Gregory <mgregory@asc.sps.mot.com> wrote:
>allbery@kf8nh.apk.net (Brandon S. Allbery KF8NH) writes:
>
>> Also sprach ced@bcstec.ca.boeing.com (Charles DeRykus) (<Ev14w2.9r0@news.boeing.com>):
>> +-----
>> | system launchs another shell apparently. I'm not sure
>> | why this happens in the case of yes though.
>> +--->8
>>
>> He included a redirection, therefore /bin/sh was used to run it.
>
>Right. This is something that it not at all clear in the current
>documentation, but Tom has added into the upcoming version, and it
>helps alot to know it!
>
You could also overlay the shell to avoid the embedded
return:
system("exec yes > /dev/null");
which'll leave $? = 2.
HTH,
--
Charles DeRykus
------------------------------
Date: Tue, 30 Jun 1998 21:11:12 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Finding the FAQ (was: Re: Arrays)
Message-Id: <Pine.GSO.3.96.980630140938.15737U-100000@user2.teleport.com>
On Tue, 30 Jun 1998, Keith L. Miller wrote:
> Where is this Perl FAQ 4 at?
I'll tell you, but you'll have to answer me one question first: Where did
you look that you failed to find the FAQ?
I'm not asking out of meanness. But you're not the only person who
couldn't find the FAQ before posting. So I'm trying to find out where
you're looking so that we can put a pointer to the FAQ there.
Thanks!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Tue, 30 Jun 1998 17:28:55 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: Flames....
Message-Id: <fl_aggie-3006981728560001@aggie.coaps.fsu.edu>
In article <6nb7vn$4a0@fridge.shore.net>, Scratchie <upsetter@ziplink.net>
wrote:
+ The point -- which most people would catch -- is that many of the docs are
+ so comprehensive that (a) they're hard for beginners to wade through
+ (whether they're programmers or not) and (b) oftentimes they assume a
+ large amount of knowledge (of other utilities or whatnot) that a beginner
+ won't always have.
And beginning shade tree auto mechanics don't start by tearing down and
rebuilding engines, either. They start a bit simpler, like changing the
spark plugs.
James
------------------------------
Date: Tue, 30 Jun 1998 21:04:18 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Help needed!
Message-Id: <Pine.GSO.3.96.980630140118.15737R-100000@user2.teleport.com>
On 30 Jun 1998, Antti-Jussi Korjonen wrote:
> Subject: Help needed!
Please check out this helpful information on choosing good subject
lines. It will be a big help to you in making it more likely that your
requests will be answered.
http://www.perl.com/CPAN/authors/Dean_Roehrich/subjects.post
> One way to prevent other users accessing the same pad as I is to make a
> lock file, right?
>
> But then, the pad can be accessed just simply telnetting the same computer
> and doing it all by hand. And now my program has no idea that somebody
> else is already accessing the pad I'm trying to connect to.
Right; file locking (in most cases) is advisory only. For it to work,
everyone has to play by the rules. Cheers!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Tue, 30 Jun 1998 16:57:18 -0400
From: Gordon Avery <gavery@uu.net>
Subject: HTML Form value problem
Message-Id: <3599512E.552C@uu.net>
Hi,
I'm trying to write a script that will take a variable from a
two-dimensional array and put the value as the initial value of a text
box in a form in an HTML document.
I'm using something like this:
<input type="text" name="class" size=30 value="$data[0][1]">
It seems to work if I use some other variable like
<input type="text" name="class" size=30 value="$dog">
where dog has been initialized to some string.
When I run the script from a prompt, the text file that it generates
looks like a valid HTML document with the correct values in place.
I would appreciate any help.
Sincerely,
Gordon Avery
gavery@uu.net
------------------------------
Date: Tue, 30 Jun 1998 23:53:05 GMT
From: Rick Delaney <rick.delaney@shaw.wave.ca>
To: Gordon Avery <gavery@uu.net>
Subject: Re: HTML Form value problem
Message-Id: <35996DF7.A249252@shaw.wave.ca>
Gordon Avery wrote:
Assuming:
print <<FIRST;
> <input type="text" name="class" size=30 value="$data[0][1]">
FIRST
>
> It seems to work if I use some other variable like
>
print <<SECOND;
> <input type="text" name="class" size=30 value="$dog">
SECOND
>
> where dog has been initialized to some string.
Well, is $data[0][1] initialized also? Are you using -w? If you set
$dog = $data[0][1] then both lines of output will be the same. You are
using Perl 5, right?
--
Rick Delaney
rick.delaney@shaw.wave.ca
------------------------------
Date: Tue, 30 Jun 1998 22:44:56 GMT
From: s123@ptd.net
Subject: http client file download?
Message-Id: <35996649.137757414@news.ptd.net>
Does anyone know how to download a file using something like LWP?
I can retrieve and submit using post, however, when I want to retrieve
a special non-html file (you know when you are in a browser and it
asks you to save a file that your are downloading) I get an error.
Can maybe I need some special Accept command in my headers?
Any help is appreciated!
------------------------------
Date: 30 Jun 1998 21:05:37 GMT
From: Eli the Bearded <*@qz.to>
Subject: Re: i've got a forking problem
Message-Id: <eli$9806301702@qz.little-neck.ny.us>
In comp.lang.perl.misc, Dan Perez <dperez@blue.seas.upenn.edu> wrote:
I find the subject highly amusing. Do you watch RHPS often?
> Here is the script that I have:
<snip bad code>
> Very straightforward, right? Open the test file which has three
> lines. "1" on the first line, "2" on the next, "3" on the last line.
> Read through the file, forking off a process at each line so that the
> child can print out the line and exit.
Use sysopen and sysread. I don't think you can rely on stdio functions
to be in sync after a fork.
Elijah
------
same will hold true in C, FWIW
------------------------------
Date: 30 Jun 1998 21:15:26 GMT
From: dperez@blue.seas.upenn.edu (Dan Perez)
Subject: Re: i've got a forking problem
Message-Id: <6nbkhe$mgr$1@netnews.upenn.edu>
Eli the Bearded (*@qz.to) wrote:
: I find the subject highly amusing. Do you watch RHPS often?
I actually just saw it this past Saturday night... it was sort of
weak. Everyone was just yelling obscenities at the screen which got
very old very fast.
: Use sysopen and sysread. I don't think you can rely on stdio functions
: to be in sync after a fork.
i just read up on sysread and it takes the number of bytes to be
read in from the filehandle. the number of bytes per lines will vary
in the real version of this script, so I can't use this.
has anyone actually ran this script to see what it does? i found it
quite interesting...
thanks,
dan
------------------------------
Date: 30 Jun 1998 22:19:24 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: i've got a forking problem
Message-Id: <6nbo9c$5vc$1@csnews.cs.colorado.edu>
Here's the private mail I sent:
>> : while (<F>) {
>> : fork && next;
>> : print;
>> : exit;
>> : }
>>
>> You're duplicating stdio buffers. Tsk.
>hunh? first of all, why? stdio has nothing to do with this, i am
>reading from a filehandle. fine, fork duplicates this filehandle but the
>child prints out the line and exits without touching the filehandle and
>the parent process should just continue to read the filehandle where it
>left off from, right? so, there shouldn't be any problems there, as far
>as I can figure. second of all, how do i fix that? i have tried to turn
>off the buffering "$| = 1;" but that didn't help.
Only output buffering is affected by $|, not input buffering. I believe
you have three different problems here. The input buffers are duplicated.
The seek pointers are shared and advance together in all processs (but
buffer consumption doesn't). The scheduling of the different process
is non-deterministic.
You can use sysread to avoid the first problem, but since the reading
is in a different process, it's very annoying to try to communicate that
failed read at eof back to the parent.
I do not know for sure that the other problems are cured.
I can guarantee that the last one isn't, and that these lines
sometimes come out in the wrong order. Furthermore, I'm rather
nervous about the second one. I get strange results that are not
reproducible.
This is, of course, horrifically inefficient.
You need to read up on Stevens on how seek pointers are shared across
all instances of a filehandle. This is quite important.
--tom
$master = $$;
$done = 0;
$SIG{USR1} = sub { $done++ };
while (!$done) {
next if $pid = fork;
die "fork: $!" unless defined $pid;
$_ = '';
do {
unless (sysread(STDIN, $char, 1)) {
kill USR1 => $master;
last;
}
$_ .= $char;
} until $char eq "\n";
print "$$ $. $_";
exit;
}
while ($pid = wait) {
last if $pid == -1;
}
--
X-Windows: The art of incompetence.
--Jamie Zawinski
------------------------------
Date: 30 Jun 1998 22:20:12 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: i've got a forking problem
Message-Id: <6nboas$5vc$2@csnews.cs.colorado.edu>
In comp.lang.perl.misc,
Eli the Bearded <*@qz.to> writes:
:Use sysopen and sysread. I don't think you can rely on stdio functions
:to be in sync after a fork.
Sysopen is irrelevant. And some lessons in shared seek pointers
would also help.
--tom
--
double value; /* or your money back! */
short changed; /* so triple your money back! */
--Larry Wall in cons.c from the 4.0 perl source code
------------------------------
Date: Tue, 30 Jun 98 20:12:22 GMT
From: NOSPAM.thomas_wernitz@tait.co.nz (Thomas Wernitz)
Subject: Re: Java and Perl together?
Message-Id: <6nbkhb$gdq$1@wolfman.xtra.co.nz>
In article <35992B4B.EB4D3FC9@sirius.com>, bowlin@sirius.com wrote:
>Scott Baxter wrote:
>> My boss has asked me to write a perl script to scan files while another
>> guy writes a Java front end for it.
If you want to use Perl for its regex power you could consider using
OROMatcher from OROR Inc.. This is a Perl5 regex package for Java and its
FREE!
HTH,
Thomas
"most people would die sooner than think -- in fact, they do so."
-- Bertrand Russell
------------------------------
Date: 30 Jun 1998 16:26:24 -0500
From: awdorrin@mail.delcoelect.com (Albert W. Dorrington)
Subject: Re: Java and Perl together?
Message-Id: <6nbl60$b5@ws051eng.ictest.delcoelect.com>
In article <3598F568.A14806B8@ki.com>, Scott Baxter <baxter@ki.com> writes:
:> Hello!
:>
:> My boss has asked me to write a perl script to scan files while another
:> guy writes a Java front end for it.
:>
:> Any suggestions for how best to have these programs talk to one
:> another? Our solution must run on NT as well as UNIX.
Scott,
You don't say whether this is a Java application or
a Java applet. The answer to that question can change
the answer to your original question quite a bit.
- Al
--
Al Dorrington
FIRMS & Web Admin, Oracle DBA Phone: 765-451-9655
IC-DELCO CIM, Delphi Delco Electronics Systems Fax: 765-451-8230
------------------------------
Date: Thu, 25 Jun 1998 17:37:48 +0200
From: Alessandro Forghieri <alf@orion.it>
Subject: Re: Newbie sort print question
Message-Id: <35926ECC.B309DAE9@orion.it>
Greetings.
Caterpillar, Inc. wrote:
>
[...]
Perhaps my eyes are failing me, but I do not see a
$i=0;
@util=();
In your script.
I feel they should be there.
Cheers,
Alessandro
------------------------------
Date: 30 Jun 1998 20:58:15 GMT
From: brent@AAC.MsState.Edu (Brent Johnson)
Subject: PerlScript Arrays
Message-Id: <6nbjh7$cv4$2@nntp.msstate.edu>
I had some problems porting Perl code to PerlScript.. one was the fact
that @arrays did not work. I looked around on the web for any information
about the differences in straight Perl and PerlScript. Here is the
error message I get when I try to use it (and I'm using NT4 with IIS4, viewing
with IE4).
.....
Active Server Pages error 'ASP 0141'
Page Command Repeated
/brent/temp.asp, line 67
The @ command can only be used once within the Active Server Page.
.....
Any help would be appreciated,
- Brent
---------------------
Brent L. Johnson brentj@ext.msstate.edu
Project Assistant/Web Programmer brent@saturn.msstate.edu
Computer Application & Services blj1@ra.msstate.edu
http://saturn.msstate.edu/homepages/brent blj1@cobilan.msstate.edu
------------------------------
Date: 30 Jun 1998 21:00:57 GMT
From: brent@AAC.MsState.Edu (Brent Johnson)
Subject: Re: PerlScript Arrays
Message-Id: <6nbjm9$dco$1@nntp.msstate.edu>
Brent Johnson (brent@AAC.MsState.Edu) wrote:
: I had some problems porting Perl code to PerlScript.. one was the fact
: that @arrays did not work. I looked around on the web for any information
: about the differences in straight Perl and PerlScript. Here is the
: error message I get when I try to use it (and I'm using NT4 with IIS4, viewing
: with IE4).
:
: .....
: Active Server Pages error 'ASP 0141'
:
: Page Command Repeated
:
: /brent/temp.asp, line 67
:
: The @ command can only be used once within the Active Server Page.
: .....
Oops. Okay you can use arrays... but you can't assign a null value
to an array by doing: @arr = ();
This may be a difference in Perl 5.003 and Perl 5.004 (which I'm used to).
- Brent
---------------------
Brent L. Johnson brentj@ext.msstate.edu
Project Assistant/Web Programmer brent@saturn.msstate.edu
Computer Application & Services blj1@ra.msstate.edu
http://saturn.msstate.edu/homepages/brent blj1@cobilan.msstate.edu
------------------------------
Date: 30 Jun 1998 21:30:59 GMT
From: mjassels@cs.concordia.ca (Michael J Assels)
Subject: Re: PUZZLE: dutree (old)
Message-Id: <6nblej$c3p$1@newsflash.concordia.ca>
In article <6nb800$ctq$2@csnews.cs.colorado.edu>,
Tom Christiansen <tchrist@mox.perl.com> wrote:
>What is the name of the hash table being used by this program?
%::
Michael
------------------------------
Date: 30 Jun 1998 22:20:48 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: PUZZLE: dutree (old)
Message-Id: <6nboc0$5vc$3@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc, mjassels@cs.concordia.ca (Michael J Assels) writes:
>%::
Nice.
--tom
--
As of next week, passwords will be entered in Morse code.
------------------------------
Date: 30 Jun 1998 22:13:45 GMT
From: kst@king.cts.com (Keith Thompson)
Subject: Re: Randomize number between -0.5 and 0.5
Message-Id: <899244825.572517@wagasa.cts.com>
Huang (wong2020@tm.net.my) wrote:
> I have wrote the segments of codes to randomized number between 0
> and 0.1
>
[...]
>
> $randnum = ( rand (1));
> if ($randnum >=0.1) {
> $randnum = ($randnum)/10;}
Be aware that the above code segment is not only inefficient (just
use rand(0.1)), it's also incorrect. It yields numbers in the range
0.0 .. 0.1, but it will yield substantially fewer numbers in the range
0.0 .. 0.01 than in the range 0.01 .. 0.1.
--
Keith Thompson (The_Other_Keith) kst@cts.com <http://www.ghoti.net/~kst> <*>
Qualcomm, San Diego, California, USA <http://www.qualcomm.com>
It takes a Viking to raze a village.
------------------------------
Date: Tue, 30 Jun 1998 21:01:11 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: rename() not working ...any ideas?
Message-Id: <Pine.GSO.3.96.980630135856.15737Q-100000@user2.teleport.com>
On 30 Jun 1998, Glenn Holden - Internet Support wrote:
> rename("$dirpath/$oldfile", "$dirpath/$newfile");
> No error messages are generated. The file is simply NOT renamed.
If you want error messages, write code that makes error messages! Perl
doesn't read your mind unless you use the DWIM module. :-)
rename("$dirpath/$oldfile", "$dirpath/$newfile")
or die "Couldn't rename '$dirpath/$oldfile' to '$dirpath/$newfile': $!";
Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: 30 Jun 1998 22:02:06 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: rename() not working ...any ideas?
Message-Id: <6nbn8u$39o$1@mathserv.mps.ohio-state.edu>
[A complimentary Cc of this posting was sent to Tom Phoenix
<rootbeer@teleport.com>],
who wrote in article <Pine.GSO.3.96.980630135856.15737Q-100000@user2.teleport.com>:
> On 30 Jun 1998, Glenn Holden - Internet Support wrote:
>
> > rename("$dirpath/$oldfile", "$dirpath/$newfile");
>
> > No error messages are generated. The file is simply NOT renamed.
>
> If you want error messages, write code that makes error messages! Perl
> doesn't read your mind unless you use the DWIM module. :-)
>
> rename("$dirpath/$oldfile", "$dirpath/$newfile")
> or die "Couldn't rename '$dirpath/$oldfile' to '$dirpath/$newfile': $!";
Also keep in mind that it is not documented what rename() does.
This allows for a different semantic on DOSISH platforms, where
rename() fails if the target exists.
Ilya
------------------------------
Date: Tue, 30 Jun 1998 21:05:39 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: timelocal function in 2000
Message-Id: <Pine.GSO.3.96.980630140424.15737S-100000@user2.teleport.com>
On Tue, 30 Jun 1998, Darren A. Blair wrote:
> I use the timelocal in a bunch of scripts that are making calculations
> on dates using the timelocal function. Does anyone know what will
> happen using this function with dates in the year 2000 and beyond?
What happened when you tried it? :-)
The FAQ talks about y2k issues. Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: 30 Jun 1998 20:52:29 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: What a Crappy World
Message-Id: <6nbj6d$8ji$1@marina.cinenet.net>
Lloyd Zusman (ljz@asfast.com) wrote:
[Many very good points snipped]
: It's clear that you truly believe that those who come here in this
: manner with frequently asked questions are inconsiderate and
: uncivilized w/r/t usenet. But keep in mind that it's equally
: inconsiderate and uncivilized (w/r/t the larger, human society in
: which we all live) to engage in gratuitous insulting behavior.
:
: In other words, those few who do so here are just as uncivilized as
: those they are attempting to criticize.
I do understand this, and it rather surprises me to find myself in the
position of defending (though not practicing) 'impolite' responses to
impolite behavior. This thread has given me a great deal to think about.
I suppose my "throw anything at the problem" attitude is born of urgency;
we appear to be witnessing the gradual death of Usenet, in this and many
other groups. Usenet is something I'd hate to lose. Given that
politeness does not seem to stem the tide of Usenet damage, I find myself
driven to considering other options. Perhaps I'm underestimating the
power of politeness; perhaps Usenet as we previously knew it is already
dead. In either case, I'm wrong to argue as I have. Still, though, I
wonder if perhaps there is a place for well-focused rage.
I'm going to drop out of this debate and meditate for a while. Thanks to
all for making me think, a challenge even at the best of times. :)
---------------------------------------------------------------------
| Craig Berry - cberry@cinenet.net
--*-- Home Page: http://www.cinenet.net/users/cberry/home.html
| Member of The HTML Writers Guild: http://www.hwg.org/
"Every man and every woman is a star."
------------------------------
Date: 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 3032
**************************************