[16225] in Perl-Users-Digest
Perl-Users Digest, Issue: 3637 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jul 12 14:05:58 2000
Date: Wed, 12 Jul 2000 11:05:27 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <963425127-v9-i3637@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Wed, 12 Jul 2000 Volume: 9 Number: 3637
Today's topics:
Re: "Deep copying" in perl? (Tad McClellan)
Re: "Deep copying" in perl? (Randal L. Schwartz)
'my' and references <ip@ariel.utcc.utoronto.ca>
Re: 'my' and references <care227@attglobal.net>
Re: 'my' and references (Tad McClellan)
Re: ATTENTION PERL MACHOES!!!!!!!!!!!!!!!!!!! <iltzu@sci.invalid>
Re: ATTENTION PERL MACHOES!!!!!!!!!!!!!!!!!!! (Brandon Metcalf)
Re: ATTENTION PERL MACHOES!!!!!!!!!!!!!!!!!!! <foo@bar.va>
Re: ATTENTION PERL MACHOES!!!!!!!!!!!!!!!!!!! <bart.lateur@skynet.be>
Re: ATTENTION PERL MACHOES!!!!!!!!!!!!!!!!!!! <jeffahill@lucent.com>
Re: ATTENTION PERL MACHOES!!!!!!!!!!!!!!!!!!! <jboes@eoexchange.com>
Re: ATTENTION PERL MACHOES!!!!!!!!!!!!!!!!!!! <jboes@eoexchange.com>
Re: ATTENTION PERL MACHOES!!!!!!!!!!!!!!!!!!! (Nobody)
Re: ATTENTION PERL MACHOES!!!!!!!!!!!!!!!!!!! <godzilla@stomp.stomp.tokyo>
Beginner Question <d.drury@spamoffucl.ac.uk>
Re: Beginner Question <mike.solomon@eps.ltd.uk>
Re: Beginner Question (Will England)
Re: Beginner Question <sariq@texas.net>
Re: Beginner Question <care227@attglobal.net>
Re: Beginner Question <AgitatorsBand@yahoo.com>
Re: Beyond perl? Need advice... dejajason@my-deja.com
Re: Bit shifting...should be exponentiation <sb@muccpu1.muc.sdm.de>
Re: Called executable can't access net drive aabill@my-deja.com
Re: Captuing the output of a system call. <jeffahill@lucent.com>
CGI Question <by-tor@by-tor.com>
Re: CGI Question <tony_curtis32@yahoo.com>
Re: changing text in a text file <aqumsieh@hyperchip.com>
Creating a subroutine library for PerlScript <samara_biz@hotmail.com>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 12 Jul 2000 10:17:27 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: "Deep copying" in perl?
Message-Id: <slrn8movfn.6cq.tadmc@magna.metronet.com>
On 12 Jul 2000 10:15:51 -0400, kj0 <kj0@mailcity.com> wrote:
>
>
>I'm sure this is in The Manual, but I haven't been able to find it.
>What's the most convenient way of performing a "deep copy" in Perl?
^^^^
perldoc -q copy
"How do I print out or copy a recursive data structure?"
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: 12 Jul 2000 08:42:56 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: "Deep copying" in perl?
Message-Id: <m1em4zs6bj.fsf@halfdome.holdit.com>
>>>>> "kj0" == kj0 <kj0@mailcity.com> writes:
kj0> I'm sure this is in The Manual, but I haven't been able to find it.
kj0> What's the most convenient way of performing a "deep copy" in Perl?
I have a description of "why" deep copy is sometimes needed at:
http://www.stonehenge.com/merlyn/UnixReview/col30.html
For robust deep copy, I'd look at Storable::dclone().
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
------------------------------
Date: Wed, 12 Jul 2000 15:26:35 GMT
From: Peter Ip <ip@ariel.utcc.utoronto.ca>
Subject: 'my' and references
Message-Id: <396C8E2B.23EA928C@ariel.utcc.utoronto.ca>
Consider:
my $a = "one";
$b = "two";
{
$x = "a";
print "$a $x -> $$x\n";
$y = "b";
print "$b $y -> $$y\n";
}
Why does $$x produce nothing while $$y produces the desired "two"? I
kept rereading the Cookbook and
the perlsub man page about 'my' but get no answer. (What I really want
is foreach $key ( qw(a b c)) {...}
to loop over a set of variables and do something with them. I've had to
use $v = eval('$' . $key); Is there
a better way?)
TIA
Peter
------------------------------
Date: Wed, 12 Jul 2000 12:45:03 -0400
From: Drew Simonis <care227@attglobal.net>
Subject: Re: 'my' and references
Message-Id: <396CA08F.B97C58FE@attglobal.net>
Peter Ip wrote:
>
> Consider:
>
> my $a = "one";
> $b = "two";
>
> {
> $x = "a";
> print "$a $x -> $$x\n";
> $y = "b";
> print "$b $y -> $$y\n";
> }
>
> Why does $$x produce nothing while $$y produces the desired "two"?
You can't use symbolic references with my() variables.
------------------------------
Date: Wed, 12 Jul 2000 12:15:19 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: 'my' and references
Message-Id: <slrn8mp6cn.77s.tadmc@magna.metronet.com>
On Wed, 12 Jul 2000 15:26:35 GMT, Peter Ip <ip@ariel.utcc.utoronto.ca> wrote:
>Consider:
OK, but you don't want to do what you are doing...
>my $a = "one";
>$b = "two";
>
>{
> $x = "a";
> print "$a $x -> $$x\n";
> $y = "b";
> print "$b $y -> $$y\n";
>}
>
>Why does $$x produce nothing while $$y produces the desired "two"?
Because *Evil* Symbolic References only work with dynamic variables
and $a is a lexical variable.
Perl FAQ, part 7:
"What's the difference between dynamic and lexical (static) scoping?
Between local() and my()?"
>I
>kept rereading the Cookbook and
>the perlsub man page about 'my' but get no answer.
The relevant doc to read is the "Symbolic references"
section in perlref.pod (you even mention references in your
Subject, so you must have already looked in perlref. You
must have missed that section...)
But you might not want to bother with that after seeing:
http://www.plover.com/~mjd/perl/varvarname.html
http://www.plover.com/~mjd/perl/varvarname2.html
http://www.plover.com/~mjd/perl/varvarname3.html
>(What I really want
>is foreach $key ( qw(a b c)) {...}
>to loop over a set of variables and do something with them.
Why not just do:
foreach $key ( $a, $b, $c) {...}
??
No evil symrefs. That is Very Good!
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: 12 Jul 2000 15:28:11 GMT
From: Ilmari Karonen <iltzu@sci.invalid>
Subject: Re: ATTENTION PERL MACHOES!!!!!!!!!!!!!!!!!!!
Message-Id: <963415501.7966@itz.pp.sci.fi>
In article <8khvbo$ifo$1@nnrp1.deja.com>, p3rlc0dr@my-deja.com wrote:
>In article <396C435E.5A999DAC@bar.va>,
> mnatoni@rumbanet.it wrote:
>>
>> UseNet is free: Ideas you can get here and in other newsgroups are
>> (use)net earnings, if no one gives an answer to your questions, you
>> have lost nothing other but few seconds of your time.
>
>I never asked anything from comp.lang.perl.misc except for you to stop
>being MEAN.
Well, that's hardly unreasonable. Let us all grant him this small favor.
*plonk*
--
Ilmari Karonen - http://www.sci.fi/~iltzu/
"The screwdriver *is* the portable method." -- Abigail
Please ignore Godzilla and its pseudonyms - do not feed the troll.
------------------------------
Date: 12 Jul 2000 15:50:07 GMT
From: bmetcalf@nortelnetworks.com (Brandon Metcalf)
Subject: Re: ATTENTION PERL MACHOES!!!!!!!!!!!!!!!!!!!
Message-Id: <8ki43f$cr4$1@bcrkh13.ca.nortel.com>
p3rlc0dr@my-deja.com writes:
> In article <8kgs8e$f7k$1@bcrkh13.ca.nortel.com>,
> bmetcalf@nortelnetworks.com wrote:
> > care227@attglobal.net writes:
> >
> > > Godzilla movie psuedo-english.
> > ^^^^^^^^
> >
> > Bingo!!!! Didn't take too long to spot.
>
> I dont know what you mean but I think your being mean to ME!!!
Get lost, freak.
Brandon
------------------------------
Date: Wed, 12 Jul 2000 18:13:07 +0200
From: Marco Natoni <foo@bar.va>
Subject: Re: ATTENTION PERL MACHOES!!!!!!!!!!!!!!!!!!!
Message-Id: <396C9913.12E6C583@bar.va>
Ganesha,
p3rlc0dr@my-deja.com wrote:
>> UseNet is free: Ideas you can get here and in other newsgroups
>> are (use)net earnings, if no one gives an answer to your
>> questions, you have lost nothing other but few seconds of your
>> time.
> I never asked anything from comp.lang.perl.misc except for you to
> stop being MEAN.
Unfortunately, your request is off-topic in this newsgroup... :)
Best regards,
Marco
------------------------------
Date: Wed, 12 Jul 2000 19:19:12 +0200
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: ATTENTION PERL MACHOES!!!!!!!!!!!!!!!!!!!
Message-Id: <e3apms4blru50dhni91ijm3lkgufaud80a@4ax.com>
p3rlc0dr@my-deja.com wrote:
>Randal [...] makes me nerves.
Ooh, you should be extremely glad Tom Christiansen doesn't post here any
more! He even makes *me* nervous.
--
Bart.
------------------------------
Date: Wed, 12 Jul 2000 12:26:04 -0500
From: Jeff H <jeffahill@lucent.com>
Subject: Re: ATTENTION PERL MACHOES!!!!!!!!!!!!!!!!!!!
Message-Id: <396CAA2C.97CADBFB@lucent.com>
Ok, Ganesha, up until now I was with you. But the books that Randall "had a
hand in" isn't just any book. It's THE book. After reading _Learning Perl_, I
was able to write complex programs for my job at work, where we are mirgrate a
tremendous number of AWK/SED/Shell programs to Perl. This was with no previous
Perl experience. I'm sure that many others could make similar claims. When a
large number of people owe their livelihoods to one (or two or three)
man's(mens') ability to convey information in a succint and accurate manner,
yes, he(they) is(are) famous. Better? That's debatable. :)
Jeff Hill
Lucent Technologies
p3rlc0dr@my-deja.com wrote:
> Randal had writen a book but does that make him famous or better
> NO!!!!!!! He makes me nerves.
------------------------------
Date: Wed, 12 Jul 2000 13:20:26 -0400
From: Jeff Boes <jboes@eoexchange.com>
Subject: Re: ATTENTION PERL MACHOES!!!!!!!!!!!!!!!!!!!
Message-Id: <396cab19$0$1497$44a10c7e@news.net-link.net>
p3rlc0dr@my-deja.com wrote:
>
>
> Brian! Your being MEAN! You need Ganesh in your life!
>
> --
> Ganesha, p3rlc0dr and WEB MISTRESS
> Guestbooks, hit counters, shopping carts: Get Matt's Script Archive
<sniff, sniff>
I smell gasoline.
<slowly backs out>
3...2...1...
--
Jeff Boes |Computer science is no more about
|jboes@eoexchange.com
Sr. S/W Engineer |computers than astronomy is about |616-381-9889 ext
18
Change Technology|telescopes. --E. W. Dijkstra |616-381-4823 fax
EoExchange, Inc. |
|www.eoexchange.com
------------------------------
Date: Wed, 12 Jul 2000 13:23:14 -0400
From: Jeff Boes <jboes@eoexchange.com>
Subject: Re: ATTENTION PERL MACHOES!!!!!!!!!!!!!!!!!!!
Message-Id: <396cab1a$0$1497$44a10c7e@news.net-link.net>
p3rlc0dr@my-deja.com wrote:
>
> In article <396C2838.3BFF4A9F@stomp.stomp.tokyo>,
> "Godzilla!" <godzilla@stomp.stomp.tokyo> wrote:
> >
> > A notion to heed well and, a bit of oxymoronic
> > humor contrasting your empty barrel beating.
>
> My English is not good but I laugh when Perl ELITE get mad and mean
> becase they know that Im right. Your scary Godzilla NO!!!!!!!!!!!!
>
And I was half-convinced that these two were in cahoots, if not the same
poster, before this...
--
Jeff Boes |Computer science is no more about
|jboes@eoexchange.com
Sr. S/W Engineer |computers than astronomy is about |616-381-9889 ext
18
Change Technology|telescopes. --E. W. Dijkstra |616-381-4823 fax
EoExchange, Inc. |
|www.eoexchange.com
------------------------------
Date: 12 Jul 2000 17:27:48 GMT
From: nobody@contract.Sun.COM (Nobody)
Subject: Re: ATTENTION PERL MACHOES!!!!!!!!!!!!!!!!!!!
Message-Id: <8ki9qk$n8u$1@eastnews1.east.sun.com>
In article <8khtgp$h8p$1@nnrp1.deja.com>, <p3rlc0dr@my-deja.com> wrote:
>In article <87puokvzkk.fsf@limey.hpcc.uh.edu>,
> Tony Curtis <tony_curtis32@yahoo.com> wrote:
>> >> On Wed, 12 Jul 2000 02:19:11 GMT,
>> >> p3rlc0dr@my-deja.com said:
>>
>> > Matt is nice. He explained me about localtime and 19100
>> > and why guestbook will do okay without file locking.
>>
>> Unfortunately,
>>
>> nice != correct
>
>But Perl people can be MEAN for no reason like the tv show WHEN ANIMALS
>ATTACK.
>
Only when people drop the right bait. This is a 'newsgroup' not a
happy little chat room. Being 'nice' is irrelevant.
Anita
------------------------------
Date: Wed, 12 Jul 2000 10:54:33 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: ATTENTION PERL MACHOES!!!!!!!!!!!!!!!!!!!
Message-Id: <396CB0D9.1D3CD99A@stomp.stomp.tokyo>
Jeff Boes wrote:
> p3rlc0dr wrote:
> > "Godzilla! wrote:
> > > A notion to heed well and, a bit of oxymoronic
> > > humor contrasting your empty barrel beating.
> > My English is not good but I laugh when Perl ELITE get mad and mean
> > becase they know that Im right. Your scary Godzilla NO!!!!!!!!!!!!
> And I was half-convinced that these two were in cahoots, if not the same
> poster, before this...
You boys have about as much a lick of sense as
Mother Nature gives her common road toad. I doubt
you have enough common sense to even notice when
your pockets are being picked by a blind person.
Godzilla!
------------------------------
Date: Wed, 12 Jul 2000 16:31:52 +0100
From: "Duncan Drury" <d.drury@spamoffucl.ac.uk>
Subject: Beginner Question
Message-Id: <8ki32k$dso$1@uns-a.ucl.ac.uk>
I am at the very thin end of the learning of Perl. I have the book Learning
Perl, and am trying to get a foothold, but I am a little stumped by hashes.
It says in the book that $fred, @fred and %fred are all different, yet in
the chapter on hashes it keeps mentioning $fred{$key} as if this is related
to %fred.
Am I right in thinking that $fred{$key} is completely different to $fred? I
think it refers to the scalar variable referenced by $key in the hash %fred.
Argh, but I can't tell if I am right or wrong!
I wish that the book would use different words for the different hashes and
arrays and scalars so I could see that there really was some sort of
distinction!
--
Duncan Drury
Remove spamoff from email address to genuinely reply.
SPAM the SPAMers!
------------------------------
Date: Wed, 12 Jul 2000 16:39:22 +0100
From: "mike solomon" <mike.solomon@eps.ltd.uk>
Subject: Re: Beginner Question
Message-Id: <8ki3h7$2k7df$1@ID-36965.news.cis.dfn.de>
You are correct in thinking that $fred{$key} is completely different to
$fred
Duncan Drury <d.drury@spamoffucl.ac.uk> wrote in message
news:8ki32k$dso$1@uns-a.ucl.ac.uk...
> I am at the very thin end of the learning of Perl. I have the book
Learning
> Perl, and am trying to get a foothold, but I am a little stumped by
hashes.
>
> It says in the book that $fred, @fred and %fred are all different, yet in
> the chapter on hashes it keeps mentioning $fred{$key} as if this is
related
> to %fred.
>
> Am I right in thinking that $fred{$key} is completely different to $fred?
I
> think it refers to the scalar variable referenced by $key in the hash
%fred.
> Argh, but I can't tell if I am right or wrong!
>
> I wish that the book would use different words for the different hashes
and
> arrays and scalars so I could see that there really was some sort of
> distinction!
>
>
>
> --
> Duncan Drury
>
> Remove spamoff from email address to genuinely reply.
> SPAM the SPAMers!
>
>
------------------------------
Date: Wed, 12 Jul 2000 15:56:37 GMT
From: will@mylanders.com (Will England)
Subject: Re: Beginner Question
Message-Id: <slrn8mp5c4.ps2.will@mylanders.com>
On Wed, 12 Jul 2000 16:31:52 +0100, Duncan Drury
<d.drury@spamoffucl.ac.uk> wrote:
>Am I right in thinking that $fred{$key} is completely different to $fred? I
>think it refers to the scalar variable referenced by $key in the hash %fred.
>Argh, but I can't tell if I am right or wrong!
>
In a nutshell, Yes. :-)
To elaboryte, $fred is a single scalar; $fred = 16.
%fred is a hash, which is an array using keys instead of numbers
for placeholders.
@fred is a conventional array.
To compare:
Hash %fred: Array @fred:
-----------------------------------------------------
key | value | key | value
------------------- | -------------------
make | ford | 0 | ford
model | taurus | 1 | taurus
color | blue | 2 | blue
trans | auto | 3 | auto
Now, we've got a similar set of values stuffed into both an
array and a hash.
To access any one of the data values in the array, we reference
it like this:
$fred[2] #This returns the value 'blue'.
Which means this: Return the scalar value of whatever is stored
in the third slot of array @fred.
"Third" slot you ask? Yes. Remember, arrays start numbering
at 0, not 1 in perl. Another benefit of hashes is that you
have the named keys for reference.
Accessing hashes is similar, and gives you the mnemonic key to
work with as well. Ex:
$fred{'color'} #This also returns the value 'blue'.
Which means this: Return the scalar value of whatever is stored
in the slot named 'color' in the hash %fred.
Now, we still have the old $fred from above which still contains
a single value.
Usage:
print "I have a $fred{'color'} $fred[0] $fred{'model'} and \n";
print "I can drive it when I'm $fred years old.\n";
This returns:
I have a blue ford taurus and
I can drive it when I'm 16 years old.
perldoc perlvar will explain all of this as well.
HTH,
Will
--
"If Al Gore invented the Internet, then I invented spellcheck!"
Dan Quayle, quoted at the National Press Club, 8/3/1999
pgpkey at http://will.mylanders.com/pub_pgp.asc
Recovery page: http://will.mylanders.com/ will@mylanders.com
------------------------------
Date: Wed, 12 Jul 2000 11:03:07 -0500
From: Tom Briles <sariq@texas.net>
Subject: Re: Beginner Question
Message-Id: <396C96BB.53018BB@texas.net>
Will England wrote:
>
> On Wed, 12 Jul 2000 16:31:52 +0100, Duncan Drury
> <d.drury@spamoffucl.ac.uk> wrote:
> >Am I right in thinking that $fred{$key} is completely different to $fred? I
> >think it refers to the scalar variable referenced by $key in the hash %fred.
> >Argh, but I can't tell if I am right or wrong!
> >
>
> In a nutshell, Yes. :-)
>
> To elaboryte, $fred is a single scalar; $fred = 16.
>
> %fred is a hash, which is an array using keys instead of numbers
> for placeholders.
>
> @fred is a conventional array.
>
> perldoc perlvar will explain all of this as well.
perlvar documents Perl's predefined variables.
Make that:
perldoc perldata
- Tom
------------------------------
Date: Wed, 12 Jul 2000 12:06:12 -0400
From: Drew Simonis <care227@attglobal.net>
Subject: Re: Beginner Question
Message-Id: <396C9774.E819617A@attglobal.net>
Duncan Drury wrote:
>
> It says in the book that $fred, @fred and %fred are all different, yet in
> the chapter on hashes it keeps mentioning $fred{$key} as if this is related
> to %fred.
>
> Am I right in thinking that $fred{$key} is completely different to $fred? I
> think it refers to the scalar variable referenced by $key in the hash %fred.
> Argh, but I can't tell if I am right or wrong!
You are correct, and it is kinda confusing when you only look at the
notation. $ is a scalar use variable, @ is for array variables and
% is for associative arrays (hashes). But when you are wanting just 1
element from the hash or array, you are seeking a scalar element, right?
Just a bit of the overall structure.
I am totally ignoring complex data structures here, since it is far
easier to understand when not working with multi-dimensional
structures. For a detailed discourse on these, read:
http://www.perl.com/pub/doc/manual/html/pod/perlref.html
So, to get at the value associated with the $key (a scalar variable),
you use the notation $fred{key}. This returns you the value associated
with $key. The same is true for understanding arrays. The nth element
of @array is discovered by $array[n]
So its easy to keep in mind. @ and % refer to the entire data
structure,
while $ (when used in the way I demonstrated) refers to a portion on
that
structure.
------------------------------
Date: Wed, 12 Jul 2000 16:25:40 GMT
From: Scratchie <AgitatorsBand@yahoo.com>
Subject: Re: Beginner Question
Message-Id: <8_0b5.23$y5.3527@news.shore.net>
Duncan Drury <d.drury@spamoffucl.ac.uk> wrote:
: Am I right in thinking that $fred{$key} is completely different to $fred? I
: think it refers to the scalar variable referenced by $key in the hash %fred.
: Argh, but I can't tell if I am right or wrong!
You are absolutely correct. %fred refers to the entire hash, but when you
refer to a *member* of the hash, that member is a single scalar variable,
so you use the "$" (i.e. $fred{$key}). The curly braces tip you off to the
fact that it's a member of a hash (as opposed to, say, a member of an
array, which might look like $barney[2]).
Once you get used to it it will start to make (some) sense. Hang in there!
--Art
------------------------------
Date: Wed, 12 Jul 2000 15:02:22 GMT
From: dejajason@my-deja.com
Subject: Re: Beyond perl? Need advice...
Message-Id: <8ki19m$jv5$1@nnrp1.deja.com>
In article <smnfbduend685@corp.supernews.com>,
cberry@cinenet.net (Craig Berry) wrote:
> This same argument came up quite often between compiled-language and
> assembler afficionados, a couple of decades ago. The same comparison
> applies; assembly *can* be more efficient, but compiled code usually
> actually *is* more efficient.
It wasn't even that long ago, but the argument is different. Assembly
will always be more effecient but is drastically inferior in it's
code-reuse and code-correctness capabilities. In this case, C++ is
superior to perl in those aspects. You can probably apply that
argument to a C vs C++ comparison.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 12 Jul 2000 15:35:43 GMT
From: Steffen Beyer <sb@muccpu1.muc.sdm.de>
Subject: Re: Bit shifting...should be exponentiation
Message-Id: <8ki38f$7pi$1@solti3.sdm.de>
In article <0E16861EE7BCD111BE9400805FE6841F11018D8D@c1s5x001.cor.srvfarm.origin-it.com>, Simon Armstrong <Simon.Armstrong@nojunkmail.uk.origin-it.com> wrote:
> Thanks for your response.
You're welcome. :-)
> Yep, I goofed. The bit shifting part was removed in the simplified example I
> posted, and my real problem is with the exponentiation.
> Your response pointed out that exponentiation is just multiplying a number
> by itself... I guess I sort of forgot this!... and so I'm experimenting with
> doing that in a loop and masking out the top part of the result each time
> round.
This is probably mathematically incorrect unless you calculate modulo some number,
which should be a prime number just to be sure (there are other numbers that
work, if I remember my Algebra well, but can't remember how to determine them).
I.e., (a mod p) * (b mod p) == (a * b) mod p
> Can't get the "right" answer so far, and perhaps I'm on the wrong
> track, but I'll give it a try.
Problem is the finite precision of integer and floating data types on
computers. You'll definitely need something with arbitrary precision
like Bit::Vector to do this.
> You also probably noticed the other glaring error in my code... the "& 256"
> should be "& 255"!
No, I didn't, I was too busy with the other errors! :-)
> I've downloaded the bit vector stuff and will take a look at it shortly.
Should do the trick, especially because all else will probably be
too slow.
> Thanks
> Simon Armstrong
> (remove .nojunkmail to email)
Good luck,
--
Steffen Beyer <sb@engelschall.com>
http://www.engelschall.com/u/sb/whoami/ (Who am I)
http://www.engelschall.com/u/sb/gallery/ (Fotos Brasil, USA, ...)
http://www.engelschall.com/u/sb/download/ (Free Perl and C Software)
------------------------------
Date: Wed, 12 Jul 2000 17:12:53 GMT
From: aabill@my-deja.com
Subject: Re: Called executable can't access net drive
Message-Id: <8ki8u1$q3k$1@nnrp1.deja.com>
Ok - I found the answer - here's how I did it (with dummy
passwords). Hope it's useful to someone...
$mailprog = "d:\\progs\\mailsend\\mailsend.exe";
$recipient = "bill allison";
$subject = "Intranet Suggestion";
$postoffice="\\\\earlston\\data\\msmail\\data";
$bodyfile='d:\\data\\bsw\\cgi-bin\\body.txt';
#delete any existing mapping - send errors to nul
#map m: to the location of the postoffice - m: is mailsend's
#default location to look in. Hide response in nul.
#call mailsend - that this works tells me that mappings are persistent
#across perl system() calls - handy! I will use a log file instead of
#nul here (honest). Oh and the user who is running the web server must
#of course have rights to the Netware resources.
system('net use m: /DELETE >nul');
system('net use m: '.$postoffice.' 12345678 /USER:admin >nul');
system ($mailprog.' -fadmin -p12345678 -s'.$subject.' -t'.$recipient.' -
i'.$bodyfile >nul);
--------------------------------------------------------------------
In article <8kfoas$vcf$1@nnrp1.deja.com>,
aabill@my-deja.com wrote:
> Platform:
> Intranet on IIS 4.0 on NT Server 4.0 SP6a with Novell client
> ActivePerl 5 Build 613
>
> Problem:
> I need intranet users to be able to e-mail suggestions to a particular
> MSMail account. I can't use a mailto: in the client html because IE
> won't parse the mailto:'s subject field (and Netscape is not an option
> for us) and a subject field is needed to tell the recipient which of
> two mail forms on the intranet was the source.
>
> So I've used a client mail form to call a perl script to send mail to
> the MSMail Post Office on our Netware 5 server. The script does a
system
> () to call a "mailsend" executable with parameters, one of which is
the
> network location of the post office - in this case
> //earlston/data/msmail/data. The script works fine from the command
> line but not when invoked from a browser.
>
> I have realised that although the Netware box is logged on and visible
> from the NT box, it is not visible to the script when called from the
> browser. I have tried creating a virtual directory mapped to the Post
> Office directory to get round this but although it creates apparently
> normally, and it's contents are visible in the mamngement console, the
> icon is a red "Error" and the approach has not worked.
>
> I've read hundreds of FAQs and searched all the postings - if someone
> does have an answer I will be very, very grateful.
>
> Thanks in anticipation,
> Bill Allison
> BSW Timber plc
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
>
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Wed, 12 Jul 2000 12:30:29 -0500
From: Jeff H <jeffahill@lucent.com>
Subject: Re: Captuing the output of a system call.
Message-Id: <396CAB35.CB602FB8@lucent.com>
Thank you!!!! You gave me the piece of the puzzle that I was missing. In my
haste to try to make the Perl code work, I neglected looking at the Apache error
log. It seems that the path to my file is in my engineering user account, but
not in my webmaster account. I included an absolute path refence to the
executable, and it works beautifully!
And a thanks to Drew Simonis, as you helped me get a little more familiar with
qx//. (Incidently, on the Perl.com page, the label is wrong, does anyone know
to whom I report that, if anyone?)
Jeff Hill
Lucent Technologies
Tony Curtis wrote:
> Running the code from the command line and redirecting
> stdout would also be a good test. Maybe the output is
> going to stderr?
------------------------------
Date: Wed, 12 Jul 2000 16:23:11 GMT
From: John Nichel <by-tor@by-tor.com>
Subject: CGI Question
Message-Id: <396C9BF3.824CA85F@by-tor.com>
Is there any way I can get Perl to send back HTML code and have it appear as such when called from a HTML <IMG> tag? SSI isn't an option.
--
*********************************
* *
* John C. Nichel IV *
* Web-Guru, By-Tor's Doghouse *
* http://www.by-tor.com *
* by-tor@by-tor.com *
* ICQ# 650118 *
* *
*********************************
------------------------------
Date: 12 Jul 2000 11:32:39 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: CGI Question
Message-Id: <87lmz7b97c.fsf@limey.hpcc.uh.edu>
>> On Wed, 12 Jul 2000 16:23:11 GMT,
>> John Nichel <by-tor@by-tor.com> said:
> Is there any way I can get Perl to send back HTML code
> and have it appear as such when called from a HTML <IMG>
> tag?
Nope. An IMG means "image", not HTML.
(And the same would apply to any language returning data
from the server-side. You might get better info from the
folks in comp.infosystems.www.authoring.cgi.)
hth
t
--
"With $10,000, we'd be millionaires!"
Homer Simpson
------------------------------
Date: Wed, 12 Jul 2000 15:35:40 GMT
From: Ala Qumsieh <aqumsieh@hyperchip.com>
Subject: Re: changing text in a text file
Message-Id: <7asntfjr8y.fsf@merlin.hyperchip.com>
David Punsalan <punsalan@che.utexas.edu> writes:
> Is it possible to directly change the text in a text file. All the
> examples I have seen involve reading the file to an array of strings
> (i.e. @lines = <FILE>)) then manipulating that array.
Then you haven't been looking at the FAQs, which is the first place you
should check. In perlfaq5, you'll find what you are looking for:
How do I change one line in a file/delete a line in
a file/insert a line in the middle of a file/append
to the beginning of a file?
--Ala
------------------------------
Date: Wed, 12 Jul 2000 13:51:02 -0400
From: "Alex T." <samara_biz@hotmail.com>
Subject: Creating a subroutine library for PerlScript
Message-Id: <396CB006.21066E6A@hotmail.com>
Hi,
I am designing a web-site using PerlScript for ASP. I have 3 scripts,
which have a number of subroutines inside them. Some of them are same
for all scripts, so I end up having multiple copies of the same
subroutine.
I wonder if there's any way I can put them in a separate file and then
just link this file to all my scripts. I tried using require <library
name> directive, but it said I have to specify the pathname to the
library in @INC. After I did that, it still didn't want to use the
subroutines from that file.
How would you go about doing this? Could you give me a simple example?
Thank you!
Alex
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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.
| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
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.
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 V9 Issue 3637
**************************************