[15884] in Perl-Users-Digest
Perl-Users Digest, Issue: 3297 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jun 8 21:10:26 2000
Date: Thu, 8 Jun 2000 18:10:18 -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: <960513017-v9-i3297@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Thu, 8 Jun 2000 Volume: 9 Number: 3297
Today's topics:
No offense but Larry Wall should do the maths !! <TheEx0rcist@fanclub.org>
Re: No offense but Larry Wall should do the maths !! <tony_curtis32@yahoo.com>
Re: No offense but Larry Wall should do the maths !! <lauren_smith13@hotmail.com>
Re: No offense but Larry Wall should do the maths !! <lr@hpl.hp.com>
Re: No offense but Larry Wall should do the maths !! <h.camp@scm.de>
Re: No offense but Larry Wall should do the maths !! <TheEx0rcist@fanclub.org>
Perl & FileMaker Pro 5 Database <fernando@ezwareconsulting.com>
Re: Perl and memory consumption <flavell@mail.cern.ch>
Re: Perl and memory consumption <jasonb885@my-deja.com>
Re: Perl and memory consumption (Eric Bohlman)
PErl Newbie with big task anuragmenon@my-deja.com
Re: PErl Newbie with big task <brian@bluecoat93.org>
Re: Problem with Perl + CPAN... <abe@ztreet.demon.nl>
Re: reading contents of an ASCII file (Craig Berry)
running a batch file with perl script througha web page <jdarpa@ercreative.com>
Re: running a batch file with perl script througha web <james@208.23.123.242>
Re: running a batch file with perl script througha web <jdarpa@ercreative.com>
Re: sending mails with perl <a@b.c>
Re: Simple regexp question (Abigail)
Re: Simple regexp question <rick.delaney@home.com>
Re: Solution needed for 'simple' task. <abe@ztreet.demon.nl>
Re: URI encoded parameter for CGI.pm problem. <flavell@mail.cern.ch>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 9 Jun 2000 02:02:52 +0200
From: "TheEx0rcist" <TheEx0rcist@fanclub.org>
Subject: No offense but Larry Wall should do the maths !!
Message-Id: <8hpc6b$buc$1@news6.isdnet.net>
Why isn't "print int(rand*3)" the same as "print int(3*rand)" ??? Isn't
multiplication supposed to be _always_ commutative?
I'm using Perl 5.6.0 on Win2k
--
Charles Henry
------------------------------
Date: 08 Jun 2000 19:39:32 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: No offense but Larry Wall should do the maths !!
Message-Id: <87n1kvit6j.fsf@limey.hpcc.uh.edu>
>> On Fri, 9 Jun 2000 02:02:52 +0200,
>> "TheEx0rcist" <TheEx0rcist@fanclub.org> said:
> Why isn't "print int(rand*3)" the same as "print
> int(3*rand)" ??? Isn't multiplication supposed to be
> _always_ commutative?
> I'm using Perl 5.6.0 on Win2k
There *was* meant to be a smiley in there somewhere wasn't
there?
--
"Trying is the first step towards failure"
Homer Simpson
------------------------------
Date: Thu, 8 Jun 2000 17:19:44 -0700
From: "Lauren Smith" <lauren_smith13@hotmail.com>
Subject: Re: No offense but Larry Wall should do the maths !!
Message-Id: <8hpd5s$voi$1@brokaw.wa.com>
TheEx0rcist <TheEx0rcist@fanclub.org> wrote in message
news:8hpc6b$buc$1@news6.isdnet.net...
> Why isn't "print int(rand*3)" the same as "print int(3*rand)" ??? Isn't
> multiplication supposed to be _always_ commutative?
>
Because you are using a random number?
perldoc -f srand
C:\>perl -w
srand(123);
print int (3 * rand());
^Z
0
C:\>perl -w
srand(123);
print int (rand() * 3);
^Z
0
C:\>perl -v
This is perl, version 5.005_03 built for MSWin32-x86-object
(with 1 registered patch, see perl -V for more detail)
Copyright 1987-1999, Larry Wall
Binary build 522 provided by ActiveState Tool Corp.
http://www.ActiveState.com
Built 09:52:28 Nov 2 1999
Lauren
------------------------------
Date: Thu, 8 Jun 2000 17:41:25 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: No offense but Larry Wall should do the maths !!
Message-Id: <MPG.13a9dd0e641e64d398ab51@nntp.hpl.hp.com>
In article <8hpc6b$buc$1@news6.isdnet.net> on Fri, 9 Jun 2000 02:02:52
+0200, TheEx0rcist <TheEx0rcist@fanclub.org> says...
> Why isn't "print int(rand*3)" the same as "print int(3*rand)" ??? Isn't
> multiplication supposed to be _always_ commutative?
Yes, but there is no multiplication in the first example.
Try it again with '+' instead of '*'. You will get a perhaps more
useful warning than the one with '*'. (Please don't tell me you posted
snippets like that without testing them with warnings on!).
Hint for the truly lazy: Try it again with rand() instead of just rand.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 9 Jun 2000 00:41:27 GMT
From: H. Camphausen <h.camp@scm.de>
Subject: Re: No offense but Larry Wall should do the maths !!
Message-Id: <8hpefn$pih$1@surz18.HRZ.Uni-Marburg.DE>
[F'up zu TheEx0rcist's Posting vom Fri, 9 Jun 2000 02:02:52 +0200]
> Why isn't "print int(rand*3)" the same as "print int(3*rand)" ???
Well, even int(3*rand) is not equal to int(3*rand) ...
Consider "rand" as the name of a function.
Consider the "*3" evaluating to 0 (*3 ~ 0*3).
That is, rand() is called with 0 as parameter (upper limit auf the
random-number-range).
This seems to result in resulting 0-values.
Hmmm.
hth + mfg, Hartmut
--
CREAGEN Computerkram Fon: 06424/923826
Hartmut Camphausen Fax: 06424/923827
Kirchstraße 8 E-Mail: h.camp@creagen.de
35043 Marburg WWW: http://www.creagen.de
------------------------------
Date: Fri, 9 Jun 2000 03:03:54 +0200
From: "TheEx0rcist" <TheEx0rcist@fanclub.org>
Subject: Re: No offense but Larry Wall should do the maths !!
Message-Id: <8hpfoq$dke$1@news6.isdnet.net>
> Because you are using a random number?
>
> perldoc -f srand
>
> C:\>perl -w
> srand(123);
> print int (3 * rand());
> ^Z
> 0
> C:\>perl -w
> srand(123);
> print int (rand() * 3);
> ^Z
> 0
HMMMM pretty obfuscating expamples
------------------------------
Date: Thu, 08 Jun 2000 23:41:42 GMT
From: Fernando Mladineo <fernando@ezwareconsulting.com>
Subject: Perl & FileMaker Pro 5 Database
Message-Id: <8hpavj$q19$1@nnrp1.deja.com>
Hi everyone!! I'm a new user to Perl and I am stuck. I have no clue as
to how I will read and write to a FileMaker Pro 5 database using Perl.
I'm connecting through ODBC. I'm working on a Windows machine right
now, but this will be implemented on an Apple system. I don't know if
that makes a difference. I have ActivePerl installed w/ the DBI &
DBD::ODBC stuff installed as well.
TIA,
Fernando
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Fri, 9 Jun 2000 00:19:24 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Perl and memory consumption
Message-Id: <Pine.GHP.4.21.0006090018410.24487-100000@hpplus03.cern.ch>
On Thu, 8 Jun 2000, Dan Sugalski wrote:
> Well, there's hope for everyone, and no reason to be rude regardless.
We're all agog to see just how long your patience lasts out.
------------------------------
Date: Thu, 08 Jun 2000 23:07:13 GMT
From: |Odo| <jasonb885@my-deja.com>
Subject: Re: Perl and memory consumption
Message-Id: <8hp8um$olu$1@nnrp1.deja.com>
In article <yobvgzk11l3.fsf@panix2.panix.com>,
David Meyers <dmeyers@panix.com> wrote:
>
>
> Jason, you've reached a point in the discussion
> where you are wating your time by further interacing
> with the Godzilla troll. It's quite incapable of
> reading that which, even out of context, Dan wrote
> quite clearly.
>
> Once a troll's errors have been publicly corrected,
> continuing to argue helps nobody. Correct it and
> move on.
I agree. I'm done feeding the troll. Thanks!
> --d
>
>
--
Sincerely,
Jason Boxman
http://edseek.com/ -
New Literature Message Boards!
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 8 Jun 2000 23:33:15 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: Perl and memory consumption
Message-Id: <8hpafr$n6j$1@nntp9.atl.mindspring.net>
Neil Kandalgaonkar (nj_kanda@alcor.concordia.ca) wrote:
: I think it's high time for the comp.lang.perl.misc-trolls web page.
: I'll post an URL soon.
May I suggest that the site's logo be an image of a camel in the process
of spitting?
------------------------------
Date: Thu, 08 Jun 2000 23:31:58 GMT
From: anuragmenon@my-deja.com
Subject: PErl Newbie with big task
Message-Id: <8hpade$pjc$1@nnrp1.deja.com>
Hey guys..
I am a perl newbie and I am trying to dothe following...
write a form from which I write a CGI to display a set of records from a
sybase database that I connect too. Then I choose one record fromthat
list which in turn will query the database again and then when those
records are ready, depending on the data in them - which I have to
access, I have to create a text file with plugins from that data that I
send a URL of to the main browser.
Anyone know what the way is to do this..some kind of a flow diagram with
the key perl concepts I need to know about? I am trying to learn the
language and having a lot of success at it, but some guidance will be
great..
I think the most pressing this is how to connect tot he cybase db from a
frame and then access individual records (and fields in those records)
so that I can use them as just text to put together another text file..
I'll appreciate any posts and directives on this one!
Thanks,
Vinod.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Thu, 8 Jun 2000 20:00:48 -0400
From: "Brian Landers" <brian@bluecoat93.org>
Subject: Re: PErl Newbie with big task
Message-Id: <1sW%4.7277$Zl6.49945@news1.atl>
Hi Vinod,
For connecting to Sybase, take a look at the DBI module, which is
the standard Perl interface to databases. You can find information about
this module at: http://search.cpan.org/doc/TIMB/DBI-1.13/DBI.pm. You
will also need to look at the Sybase "driver" for DBI, DBD::Sybase, which
can be found at: http://search.cpan.org/search?module=DBD::Sybase
You might also want to look at the O'Reilly book "Programming the Perl
DBI" which covers the database interface in detail.
Cheers,
Brian
<anuragmenon@my-deja.com> wrote in message
news:8hpade$pjc$1@nnrp1.deja.com...
> Hey guys..
>
> I am a perl newbie and I am trying to dothe following...
>
> write a form from which I write a CGI to display a set of records from a
> sybase database that I connect too. Then I choose one record fromthat
> list which in turn will query the database again and then when those
> records are ready, depending on the data in them - which I have to
> access, I have to create a text file with plugins from that data that I
> send a URL of to the main browser.
>
> Anyone know what the way is to do this..some kind of a flow diagram with
> the key perl concepts I need to know about? I am trying to learn the
> language and having a lot of success at it, but some guidance will be
> great..
>
> I think the most pressing this is how to connect tot he cybase db from a
> frame and then access individual records (and fields in those records)
> so that I can use them as just text to put together another text file..
>
> I'll appreciate any posts and directives on this one!
> Thanks,
>
> Vinod.
>
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
------------------------------
Date: Fri, 09 Jun 2000 02:05:54 +0200
From: Abe Timmerman <abe@ztreet.demon.nl>
Subject: Re: Problem with Perl + CPAN...
Message-Id: <41d0ks4eiumdkvbtrio6or5jcegi4h5nog@4ax.com>
On Thu, 8 Jun 2000 14:36:25 +0200, "news.sektornet.dk"
<cyklus@hotmail.com> wrote:
> Btw. first time i used perl -MCPAN... it created some sort of configuration
> file from answers i typed in like what cpan archieve to use etc.. any idea
> where i can find the config file and how i can reconfigure it?
type:
perl -MCPAN -e 'shell'
and you'll get the cpan prompt.
type: h (or ?) to get help
with 'o conf [option]' you can get/set config options
--
Good luck,
Abe
------------------------------
Date: Thu, 08 Jun 2000 23:50:03 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: reading contents of an ASCII file
Message-Id: <sk0c9b9mh51161@corp.supernews.com>
Mark Holt (madmardy@madmardy.com) wrote:
: $/ = undef;
: open FILE, "file.txt";
: $contents = <FILE>;
: close FILE;
: $/ = "\n";
Right idea, bad form on handling localization of the $/ change (suppose
calling code had set it to something other than \n, and expected it to
stay that way?). This is better:
open FILE, '< file.txt' or die $!;
$contents = do { local $/; <FILE>; };
close FILE;
Or you may replace that middle line with
read FILE, $contents, -s FILE;
--
| Craig Berry - http://www.cinenet.net/users/cberry/home.html
--*-- "You live in Los Angeles, and you are going to Reseda; we are
| all in some way or another going to Reseda someday, to die."
- Soul Coughing
------------------------------
Date: Thu, 08 Jun 2000 23:54:23 GMT
From: "Jason Darpa" <jdarpa@ercreative.com>
Subject: running a batch file with perl script througha web page
Message-Id: <PmW%4.2289$Uo3.188143@dfiatx1-snr1.gtei.net>
What is the source to run a batch file from a perl script from a remote
location over a web page.. The batch file will be restarting a NT service if
it goes down.
Thanks
Jason
jdarpa@ercreative.com
------------------------------
Date: Thu, 08 Jun 2000 20:15:02 -0700
From: James Tolley <james@208.23.123.242>
Subject: Re: running a batch file with perl script througha web page
Message-Id: <39406136.8173A05F@208.23.123.242>
Jason Darpa wrote:
>
> What is the source to run a batch file from a perl script from a remote
> location over a web page.. The batch file will be restarting a NT service if
> it goes down.
What did you try, and what happened?
hth,
James
------------------------------
Date: Fri, 09 Jun 2000 00:24:09 GMT
From: "Jason Darpa" <jdarpa@ercreative.com>
Subject: Re: running a batch file with perl script througha web page
Message-Id: <JOW%4.2310$Uo3.195898@dfiatx1-snr1.gtei.net>
Well, Im not a perl programmer.. I was just asking for a program to run a
batch file..
I have perl installed and everything.. I just dont know how to program it.
Thanks
Jason
"James Tolley" <james@208.23.123.242> wrote in message
news:39406136.8173A05F@208.23.123.242...
> Jason Darpa wrote:
> >
> > What is the source to run a batch file from a perl script from a remote
> > location over a web page.. The batch file will be restarting a NT
service if
> > it goes down.
>
> What did you try, and what happened?
>
> hth,
>
> James
------------------------------
Date: Thu, 08 Jun 2000 18:42:18 -0500
From: lynx <a@b.c>
Subject: Re: sending mails with perl
Message-Id: <5fV%4.15533$Ze6.267515@news.corecomm.net>
"Stefan T." <stefan.thaler@gmx.net>, in
<H8Q%4.34022$yR.466116@news.chello.at>:
> with the following lines of a perl script i can send a mail:verschicken:
> -----script-----
> #!/usr/bin/perl
> open MAIL,"|mail nothing\@nomail.at "; print MAIL"hello world"; #:-)
> close MAIL;
> ------script-----
i've been known to use things down these lines (example only):
sub sendmail ($$) {
(my $text, my $to) = @_;
my $mailer = '/bin/mail';
my @mailer_args = ('-s', 'subject here', $to);
# we need to speak to the mail sending program somehow - and
# this is a trick from the perlsec manpage. look up its hows and
# whys there.
open (MAIL, "|-") or exec ($mailer, @mailer_args);
print MAIL $text;
close (MAIL);
return (0);
}
> so what i now want to now is:
> 1. can i give this mail an subject to (at the moment there is no subject
> send with this mail) the second thing is: i would like to give this mail
> an other sender adress
> (From Header) how can i realize this??
man mail
------------------------------
Date: 9 Jun 2000 00:26:20 GMT
From: abigail@arena-i.com (Abigail)
Subject: Re: Simple regexp question
Message-Id: <8hpdjb$p10$2@news.panix.com>
On Thu, 8 Jun 2000 16:54:11 -0700, Larry Rosler <lr@hpl.hp.com> wrote:
++ In article <8hlskv$lus$1@news.panix.com> on 7 Jun 2000 16:18:40 GMT,
++ Abigail <abigail@arena-i.com> says...
++ > On Tue, 6 Jun 2000 17:23:09 -0700, Larry Rosler <lr@hpl.hp.com> wrote:
++ > ++ In article <393D91DE.57B57BAE@My-Deja.com> on Tue, 06 Jun 2000 17:05:50
++ > ++ -0700, Makarand Kulkarni <makarand_kulkarni@My-Deja.com> says...
++ > ++ > > $vbl="$INTERNAL";
++ > ++
++ > ++ > replace with $vbl="\$INTERNAL"; or else $vbl just gets the value of $INTERN
++ > ++
++ > ++ Nope. Did you test it before posting? Now the attempted interpolation
++ > ++ of $INTERNAL takes place in the regex.
++ >
++ > Eh? Interpolation only takes place in literals, or with eval.
++
++ What about in regexes?
Only in a literal. That is, the part found between the delimiters.
++ > $foo = "bar";
++ > $baz = "\$foo";
++ > $re = qr /$baz/;
++ > print $re;
++ >
++ > prints:
++ >
++ > (?-xism:$foo)
++ >
++ > The $ is still there, and no interpolation of $foo.
++
++
++ #!/usr/local/bin/perl -w
++ use strict;
++
++ my $foo = "bar";
++ my $baz = "\$foo";
++ my $re = qr /$baz/;
++ print $re, "\n";
++
++ for ($foo, $baz) {
++ $re and print "'$_' matched \$re\n";
++ /$re/ and print "'$_' matched /\$re/\n";
++ /\Q$re/ and print "'$_' matched /\\Q\$re/\n";
++ /$baz/ and print "'$_' matched /\$baz/\n";
++ /\Q$baz/ and print "'$_' matched /\\Q\$baz/\n";
++ }
++
++ __END__
++
++ Output:
++
++ (?-xism:$foo)
++ 'bar' matched $re
++ '$foo' matched $re
++ '$foo' matched /\Q$baz/
++
++ How can the strings 'bar' and '$foo' each match $re?
Well, they don't. The expression
$re
isn't a match. It's just something that isn't 0, "" or undef, and hence
it is true.
++ How can neither of
++ them match /$re/?
That's logical. '$' in a regex matches the end of a string. And neither
'$foo', nor 'bar' have the characters "f", "o" and "o" follow the end of
the string.
Abigail
------------------------------
Date: Fri, 09 Jun 2000 00:28:17 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: Simple regexp question
Message-Id: <39403B9C.534D97E0@home.com>
Larry Rosler wrote:
>
> for ($foo, $baz) {
> $re and print "'$_' matched \$re\n";
^^^^
This is not a pattern match. This is a string which is true.
This is a pattern match:
$_ =~ $re and print "'$_' matched \$re\n";
/pattern/ is short for $_ =~ /pattern/ but
EXPR is not short for $_ =~ EXPR even when
EXPR is a qr//-created regexp object.
--
Rick Delaney
rick.delaney@home.com
------------------------------
Date: Fri, 09 Jun 2000 00:30:16 +0200
From: Abe Timmerman <abe@ztreet.demon.nl>
Subject: Re: Solution needed for 'simple' task.
Message-Id: <qb70ksormrqn35kb90k20ojqqagtg653e0@4ax.com>
On Thu, 08 Jun 2000 14:47:40 GMT, Ala Qumsieh <aqumsieh@hyperchip.com>
wrote:
...
> My first thought came in two lines:
>
> @x = qw/a b c d/;
>
> print shift @x;
> print @x ? ", $_" : " and $_" while defined($_=shift @x);
and it destroys @x :-(
>
> But here's a one-liner (provided you didn't play with $[):
>
> print @x == 1 ? $x[0] : join (' and ' =>
> join (', ' => @x[0 .. $#x-1]),
> $x[-1]);
>
> Golf, anyone?
print do{(local $_ = join(', ', @x)) =~ s/(.*), /$1 and /; $_};
Does that qualify?
--
Good luck,
Abe
------------------------------
Date: Fri, 9 Jun 2000 00:16:00 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: URI encoded parameter for CGI.pm problem.
Message-Id: <Pine.GHP.4.21.0006090008310.24487-100000@hpplus03.cern.ch>
On 8 Jun 2000, The WebDragon wrote:
[over-comprehensive quotage already sets the bogosity alarms tinkling]
> | <!--include virtual="../cgi/staffdb.cgi?stafftag=p%5C%26d" -->
> | \ &
> remembering that you are dealing with html here, you might try to encode
> the ampersand with & in the url
On the other hand, remembering that you're _NOT_ dealing with HTML
here, but with the syntax of server-parsed includes (SSI), you might
want to take a moment to understand what you're doing, rather than
throwing multiple levels of random character-escaping at it and hoping
that something usable will emerge.
> and let the browser
If the browser ever gets an unprocessed SSI directive, then something
is seriously wrong
> and webserver
> 'do the right thing' with it. ;o)
Sounds like waving that dead chicken, to me.
> & must ALWAYS be writtin as & within html.
Sort-of, but it's the wrong issue here.
> (not necessarily always
> within URLS, however it doesn't BECOME a URL til someone clicks it..)
Oh gosh, you _are_ confused.
I'm sorry, I haven't an answer ready for delivery, aside from the
obvious <!--#include ..., but if I needed to known the answer, it
would be easy enough to find out, and I _am_ as sure as I need to be
that your answer was more than a little confused.
Have you considered forwarding this discussion to a group where it
would be on topic?
------------------------------
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 3297
**************************************