[10024] in Perl-Users-Digest
Perl-Users Digest, Issue: 3617 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Sep 2 12:05:06 1998
Date: Wed, 2 Sep 98 09:00:27 -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 Wed, 2 Sep 1998 Volume: 8 Number: 3617
Today's topics:
Re: [Perl] How to find the Perl FAQ (Michael Wang)
Re: a pesky perl runtime problem (Andrew M. Langmead)
Re: a pesky perl runtime problem huntersean@hotmail.com
Copying multiple dimension hashes. <mkbowler@nortel.com>
Re: Defining constant values in Perl using #DEFINE (Andrew M. Langmead)
Re: eliminate *mostly* duplicate array elements (Sean McAfee)
Re: eliminate *mostly* duplicate array elements <prl2@lehigh.edu>
Re: format problem (Andrew M. Langmead)
Re: Hats off to Tom Phoenix <murrayb@vansel.alcatel.com>
Re: Help Converting to Lowercase <prl2@lehigh.edu>
Re: Help on a simple regex (Matt Knecht)
Re: History of Perl <uri@sysarch.com>
Re: How do I create a directory only if it doesn't exis (Larry Rosler)
How do I encrypt form data in perl on unix before sendm <jimndi@sgi.net>
Re: In search of Intellegint Life... HELP!! <upsetter@ziplink.net>
Re: Interpolating from a Template (Greg Bacon)
MKI$ & CVI functions in QBasic xvisualbasic@my-dejanews.com
Re: Newbie RE Question (Greg Bacon)
Re: Newbie RE Question (Mark-Jason Dominus)
Re: Newbie RE Question (Larry Rosler)
Re: Perl & Java - differences and uses (David Cantrell)
Re: Perl & Java - differences and uses (Nathan V. Patwardhan)
Re: Perl & Java - differences and uses (David Cantrell)
Re: Perl & Java - differences and uses (David Cantrell)
Re: Perl compiler (Joe McMahon)
Re: Perl Cookbook, does anyone have it? (I R A Aggie)
Re: Perl DBI vs. LiveWire <yong@shell.com>
Re: Perl DBI vs. LiveWire <eashton@bbnplanet.com>
Re: Perl version (Andrew M. Langmead)
Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 2 Sep 1998 14:30:28 GMT
From: mwang@tech.cicg.ml.com (Michael Wang)
Subject: Re: [Perl] How to find the Perl FAQ
Message-Id: <6sjkq4$pbl$1@news.ml.com>
Martien Verbruggen <mgjv@comdyn.com.au> wrote:
>
>> There is a newer version posted by someone called tchrist dated
>
>Someone called tchrist?
>
>How funny.
OK, I have corrected the phrase to "someone whoes username is tchrist".
It is not funny to refer someone by username. It is part of internet
culture.
I check CPAN FAQ page, they are all the old version:
perlfaq - frequently asked questions about Perl ($Date: 1997/03/17 22:17:56 $)
There is a newer version "08/1998" posted by someone whose username is
"tchrist", but this newer version is not readily available. It is hidden
somewhere with the name misc/*faq*.tar.gz and not listed in the Tom Phoenix's
finding-perl-faq posting. I want to know why. Thank you.
--
unix programs: niftp (non-interactive recursive ftp), hide (hide command args),
submit (replace nohup), etc from ftp://ftp.mindspring.com/users/mwang/unix-prog
Michael Wang, mwang@ml.com, Merrill Lynch, World Financial Center, 212-449-4414
------------------------------
Date: Wed, 2 Sep 1998 14:57:31 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: a pesky perl runtime problem
Message-Id: <Eynw7v.H10@world.std.com>
"E Mills, software scientist" <eam@starfire.mlb.semi.harris.com> writes:
>This all interprested fine, but the (more stuff) wasn't being executed.
>Turns out the problem was that the call should have been:
>mysub();
>That's all well-and-good, but why no interpreter errors in the first
>case? How would the interpreter interpret just plain old "mysub"?
>Apparently it treated it as a comment.
It treated it as a constant string. The same as if you said
'mysub';
Perl will warn you of this type of problem if you run it with the "-w"
switch, and will prevent you from useing the construct at all if you
use the "strict" pragma.
#!/usr/bin/perl -w
use strict;
Perl by default is a fairly loose language, and makes all sorts of
assumptions on what you might mean for a given construct. Things like
warnings and some of the various pragmas tell perl you are
intentionally giving up some of freedoms the language gives you. (And
for anything bigger than a one liner or a throwaway script, you a
probably saving yourself more time in the long run by doing so.)
--
Andrew Langmead
------------------------------
Date: Wed, 02 Sep 1998 14:16:12 GMT
From: huntersean@hotmail.com
Subject: Re: a pesky perl runtime problem
Message-Id: <6sjjvb$jig$1@nnrp1.dejanews.com>
It didn't treat it as a comment, it treated it as a bareword (a string). It
then evaluated it in a null context (and threw the results away).
perl's philosophy is "don't just stand there complaining, do something". If
you don't like this, I suggest running your script with "perl -w". You could
also preface your script with "use strict" and "use diagnostics". You will
get a lot of friendly warnings, including a warning about your erroneous
call.
Sean H
In article <35ED2916.600CDF4C@starfire.mlb.semi.harris.com>,
"E Mills, software scientist" <eam@starfire.mlb.semi.harris.com> wrote:
> I just chased down a bug which was innocuous. My code was something like
>
> {
> (stuff)
> # subroutine call
> mysub;
> (more stuff)
> }
>
> sub mysub
> {(more stuff)
> }
>
> This all interprested fine, but the (more stuff) wasn't being executed.
> Turns out the problem was that the call should have been:
>
> mysub();
>
> That's all well-and-good, but why no interpreter errors in the first
> case? How would the interpreter interpret just plain old "mysub"?
> Apparently it treated it as a comment.
>
> Any idears?
>
> E
>
>
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: Wed, 02 Sep 1998 11:00:17 -0400
From: Michael Bowler <mkbowler@nortel.com>
Subject: Copying multiple dimension hashes.
Message-Id: <35ED5D81.70FC71BD@nortel.com>
Can someone please tell me why copying a single dimension hash actually creates
a new one, whereas copying a multi-dimensional hash copies by reference. Does
perl have a method to perform actual copies of hash trees or do I have to write
my own recursive routine?
Sample code to demonstrate my problem is below:
=====================================================
#!/opt/corp/local/bin/perl
use strict;
my (%hash1, %hash2);
print "Test #1, simple hash.\n";
%hash1 = (one => 1, two => 2);
%hash2 = %hash1;
print "Primary hash1 key/vals: one-$hash1{'one'} two-$hash1{'two'}\n";
print "Primary hash2 key/vals: one-$hash2{'one'} two-$hash2{'two'}\n";
$hash1{'one'} = 3;
print "Secondary hash1 key/vals: one-$hash1{'one'} two-$hash1{'two'}\n";
print "Secondary hash2 key/vals: one-$hash2{'one'} two-$hash2{'two'}\n";
print "\nTest #2, two dimensional hash.\n";
%hash1 = ();
%hash2 = ();
$hash1{'one'}{'i'} = 1;
$hash1{'one'}{'ii'} = 2;
%hash2 = %hash1;
print "Primary hash1 key/vals: one-$hash1{'one'}{'i'} two-$hash1{'one'}{'ii'}\n";
print "Primary hash2 key/vals: one-$hash2{'one'}{'i'} two-$hash2{'one'}{'ii'}\n";
$hash1{'one'}{'i'} = 3;
print "Secondary hash1 key/vals: one-$hash1{'one'}{'i'} two-$hash1{'one'}{'ii'}\n";
print "Secondary hash2 key/vals: one-$hash2{'one'}{'i'} two-$hash2{'one'}{'ii'}\n";
==============================================================
Running this yields an output of:
Test #1, simple hash.
Primary hash1 key/vals: one-1 two-2
Primary hash2 key/vals: one-1 two-2
Secondary hash1 key/vals: one-3 two-2
Secondary hash2 key/vals: one-1 two-2 <---hash2 remains unmodified.
Test #2, two dimensional hash.
Primary hash1 key/vals: one-1 two-2
Primary hash2 key/vals: one-1 two-2
Secondary hash1 key/vals: one-3 two-2
Secondary hash2 key/vals: one-3 two-2 <---Copied the 3 into hash2.
Thanks for your time,
--
Michael Bowler Phone: 613-765-3432
IC Design Tools - 5T11 ESN: 39+53432
Nortel Semiconductors Email: mkbowler@nt.com
------------------------------
Date: Wed, 2 Sep 1998 15:02:59 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Defining constant values in Perl using #DEFINE
Message-Id: <EynwGz.MCF@world.std.com>
"David Mohorn" <david.mohorn@sourcebbs.com> writes:
>Obviously, this won't work in Perl, but having to define:
>$RTS=1;
>$CTS=2;
>$DTR=3;
>means I could inadvertantly modify these values somewhere else in the
>program. Does Perl have a "const" modifier or similar???
I've always wondered how someone could "accidentally modify" a global
variable which is documented (in this case, by the all uppercase
convention) as being a constant.
--
Andrew Langmead
------------------------------
Date: Wed, 02 Sep 1998 14:30:36 GMT
From: mcafee@galaga.rs.itd.umich.edu (Sean McAfee)
Subject: Re: eliminate *mostly* duplicate array elements
Message-Id: <gEcH1.618$F7.2819940@news.itd.umich.edu>
In article <6sji9o$1j16@fidoii.cc.Lehigh.EDU>,
Phil R Lawrence <prl2@lehigh.edu> wrote:
>I grabbed the following from the FAQ to eliminate duplicate array elements:
> undef %saw;
> @list = grep(!$saw{$_}++, @raw_list);
>However, I need to eliminate duplicate array elements *even* if they have differing whitespace. (So I guess they would be mostly
>duplicate.)
Just eliminate the whitespace before checking %saw:
@list = grep((s/\s+//g, !$saw{$_}++), @raw_list);
Alternately:
@list = grep { s/\s+//g; !$saw{$_}++ } @raw_list;
--
Sean McAfee | GS d->-- s+++: a26 C++ US+++$ P+++ L++ E- W+ N++ |
| K w--- O? M V-- PS+ PE Y+ PGP?>++ t+() 5++ X+ R+ | mcafee@
| tv+ b++ DI++ D+ G e++>++++ h- r y+>++** | umich.edu
------------------------------
Date: Wed, 2 Sep 1998 10:59:29 -0400
From: "Phil R Lawrence" <prl2@lehigh.edu>
Subject: Re: eliminate *mostly* duplicate array elements
Message-Id: <6sjmgk$20c6@fidoii.cc.Lehigh.EDU>
>Just eliminate the whitespace before checking %saw:
>
>@list = grep((s/\s+//g, !$saw{$_}++), @raw_list);
>
>Alternately:
>
>@list = grep { s/\s+//g; !$saw{$_}++ } @raw_list;
Good answer. I'm sorry, but I'm looking to retain the whitespace in my result; I just need to discount it when comparing. Sorry I
didn't make that clear.
Phil
------------------------------
Date: Wed, 2 Sep 1998 15:04:29 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: format problem
Message-Id: <EynwJH.11o@world.std.com>
Didier LADNER <didier@referencement.net> writes:
>with error:Format not terminated at dir2.pl line 15, at end of line
> Could somebody tell me why?
The terminating dot must be in the first column. You probably don't
want the whole format indented either.
--
Andrew Langmead
------------------------------
Date: 02 Sep 1998 07:47:52 -0700
From: Brad Murray <murrayb@vansel.alcatel.com>
Subject: Re: Hats off to Tom Phoenix
Message-Id: <ulno2r2p3.fsf@vansel.alcatel.com>
chip@pobox.com (Chip Salzenberg) writes:
> Only if you were counting on being praised, and bitter in
> disappointment at your rough treatment.
>
> Philanthropy must be performed for its own sake, for moral and
> ethical reasons. Otherwise it's just currying or grandstanding.
I guess the point needs to be made a little more bluntly: if people
consistently shit on your gifts, you will probably start disliking
people and being wary of giving gifts. This situation is neither
currying nor grandstanding---it's an expectation that people will
treat a gift as something they wouldn't have had before. It's just
plain impolite to complain to the gift giver about the size or
colour. If you don't like it, help fix it or buy one you prefer,
but don't whine about the free one.
--
"Never trust a man in a blue trenchcoat, Brad Murray
Never drive a car when you're dead." Software Analyst
(Tom Waits) Alcatel Canada
------------------------------
Date: Wed, 2 Sep 1998 10:12:07 -0400
From: "Phil R Lawrence" <prl2@lehigh.edu>
Subject: Re: Help Converting to Lowercase
Message-Id: <6sjjo6$1mdi@fidoii.cc.Lehigh.EDU>
Dexter Maxwell wrote in message <35ed4b11.0@blushng.jps.net>...
>Can anyone help me??? I need to be able to convert a variable to all lower
>case.
>$data = $ENV{'QUERY_STRING'};
$data =~ tr/A-Z/a-z/;
HTH,
Phil R Lawrence
------------------------------
Date: Wed, 02 Sep 1998 14:35:14 GMT
From: hex@voicenet.com (Matt Knecht)
Subject: Re: Help on a simple regex
Message-Id: <CIcH1.703$nb7.3394936@news3.voicenet.com>
Patrick Timmins <ptimmins@netserv.unmc.edu> wrote:
>In article <6sis5q$dtd$1@trader.ipf.de>,
> "Andreas Vierengel" <avierengel@citynet.de> wrote:
>> Hi everybody!
>> I am reading lines from a file and do a regex on each line.
>> I want to match a line if it contains a certain string only ONE time.
>
>$match_once = "ab"; # or whatever you want only once in a line
>while (<>) {
> unless (/$match_once.*$match_once/) {print;}
>}
That will print out lines that don't have the match in them.
You would need to change that to:
if (/$match/ and not /$match.*$match/) {print}
Here's a way you can control how many matches you want to make.
while (<>) {
my $count = 0;
++$count while /$match/g;
print if $count == 1;
}
--
Matt Knecht - <hex@voicenet.com>
------------------------------
Date: 02 Sep 1998 11:00:32 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: History of Perl
Message-Id: <x7yas21rvz.fsf@sysarch.com>
>>>>> "MD" == Mark-Jason Dominus <mjd@op.net> writes:
MD> In article <x7zpcj19j5.fsf@sysarch.com>, Uri Guttman
MD> <uri@sysarch.com> wrote:
>> maybe someone else remembers this doc and can locate it.
MD> You're not thinking of the one on page 554 of the camel book, are
MD> you?
yes. i looked in the beginning of camel for that and i didn't find it!!
it is too lightly written to be a useful history like the orginal poster
wanted. if a full blown history gets written and published in TPJ, it
would be the first article i would read in that issue!
and such an article should be on perl.{org,com} too.
there is a flaky, psuedo biblical piece with no real details on
(programming republic of) perl's history at
http://republic.perl.com/history.html
uri
--
Uri Guttman ----------------- SYStems ARCHitecture and Software Engineering
Perl Hacker for Hire ---------------------- Perl, Internet, UNIX Consulting
uri@sysarch.com ------------------------------------ http://www.sysarch.com
The Best Search Engine on the Net ------------- http://www.northernlight.com
------------------------------
Date: Wed, 2 Sep 1998 08:31:59 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: How do I create a directory only if it doesn't exists
Message-Id: <MPG.105704ceaa74fb1198981e@nntp.hpl.hp.com>
[Posted to comp.lang.perl.misc and copy mailed.]
In article <35ED4C70.CA289CC3@micron.net> on Wed, 02 Sep 1998 07:47:28 -
0600, Ed Henderson <evhendrs@micron.net> says...
...
> use File::Path;
>
> $path = "c:/foo/bar/bletch";
> mkpath($path,1,0777);
>
> mkpath is quite nice, it will create the whole path, not just a single
> directory. If the path or any/all components currently exist, it won't
> do anything.
>
> This is a bit more than you were asking for, but it will provide what
> you need for sure...
The problem is knowing what's available in what module. It's like
learning another vocabulary. All unknowing, just last week I tossed off
the following:
sub mkpath { # Make a path (like 'mkdir -p').
local $_ = shift;
m!(.*)/[^/]*$! and mkpath($1) or return until -d or mkdir $_, 0755;
1 # Success.
}
The guts of it looks a lot like the earlier responses to this thread, and
learning how to do it made it easy for me to respond.
Modules, modules, who needs these steenkin' modules? :-)
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Wed, 02 Sep 1998 14:29:06 GMT
From: Diane Strahl <jimndi@sgi.net>
Subject: How do I encrypt form data in perl on unix before sendmail with pgp?
Message-Id: <35ED59BC.3745@sgi.net>
I have written several perl scripts that process html form data, which
is then sent to me using sendmail. The perl scripts run on a unix
machine.I need to encrypt the form data with pgp before it is sent. I
assume I do this using my public key within my perl script before
sendmail is called. I just can't find any info on how to do this. If
someone could at least point me in the right direction, I'd sure
appreciate it.
Thanks,
Diane Strahl
------------------------------
Date: Wed, 02 Sep 1998 15:46:44 GMT
From: Scratchie <upsetter@ziplink.net>
Subject: Re: In search of Intellegint Life... HELP!!
Message-Id: <ELdH1.108$kE2.957302@news.shore.net>
Mark Badolato <bady@primenet.com> wrote:
: 1;
Interesting that two people in a row posted the same thing. The semicolon
is unnecessary. Only really a concern for those who obsess over very
"wasted" keystroke, but I just thought I'd point it out in the interest of
effeciency. All you need is a "1" at the end of your included file. You
don't need a semicolon or even a newline after that.
--Art
--------------------------------------------------------------------------
National Ska & Reggae Calendar
http://www.agitators.com/calendar/
--------------------------------------------------------------------------
------------------------------
Date: 2 Sep 1998 14:47:05 GMT
From: gbacon@itsc.uah.edu (Greg Bacon)
Subject: Re: Interpolating from a Template
Message-Id: <6sjlp9$8t$4@info.uah.edu>
In article <udCCYhi19GA.139@nih2naab.prod2.compuserve.com>,
Ruben Safir <75762.2332@CompuServe.COM> writes:
: Does Perl interpolate strings aquired from a Table such as I'm doing?
No.
Take a look at mjd's Text::Template module which you can find on the
CPAN in
<URL:http://www.perl.com/CPAN/modules/by-module/Text/>
It will probably be of some help to you.
Greg
--
The surest sign that intelligent life exists elsewhere in the universe is that
it has never tried to contact us.
-- Calvin
------------------------------
Date: Wed, 02 Sep 1998 14:48:49 GMT
From: xvisualbasic@my-dejanews.com
Subject: MKI$ & CVI functions in QBasic
Message-Id: <6sjlsg$lqb$1@nnrp1.dejanews.com>
I would like to know the equivalent functions of MKI$ & CVI of QBasic in Perl.
MKI$ converts numbers into numeric strings and CVI does the reverse.
Thank you.
email: huynh.long@usa.net
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: 2 Sep 1998 14:26:22 GMT
From: gbacon@itsc.uah.edu (Greg Bacon)
Subject: Re: Newbie RE Question
Message-Id: <6sjkie$8t$2@info.uah.edu>
In article <6sib5t$avt$1@monet.op.net>,
mjd@op.net (Mark-Jason Dominus) writes:
: Use `index' instead of using a regular expression.
Why? Shouldn't the regex engine be smart enough to do Boyer-Moore
when its pattern is a constant?
Have you seen this?
#! /usr/bin/perl -w
use strict;
use Benchmark;
sub idx_search {
my $targ = shift;
index($$targ, 'sQuEaMiSh OsSiFrAgE') >= 0;
}
sub re_search {
my $targ = shift;
$$targ =~ /sQuEaMiSh OsSiFrAgE/;
}
$a = ('x' x 1024) . 'sQuEaMiSh OsSiFrAgE' . ('x' x 1024);
$b = 'x' x 1024;
timethese 80000, {
'index' => 'idx_search(\\$::a)',
're' => 're_search(\\$::a)',
};
timethese 80000, {
'index' => 'idx_search(\\$::b)',
're' => 're_search(\\$::b)',
};
I get this output:
Benchmark: timing 80000 iterations of index, re...
index: 5 wallclock secs ( 5.43 usr + 0.01 sys = 5.44 CPU)
re: 3 wallclock secs ( 3.37 usr + 0.00 sys = 3.37 CPU)
Benchmark: timing 80000 iterations of index, re...
index: 6 wallclock secs ( 5.35 usr + 0.01 sys = 5.36 CPU)
re: 3 wallclock secs ( 3.02 usr + 0.01 sys = 3.03 CPU)
Greg
--
Improve the postal system -- mail their pay checks!
------------------------------
Date: 2 Sep 1998 10:47:02 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: Newbie RE Question
Message-Id: <6sjlp6$dfj$1@monet.op.net>
In article <6sjkie$8t$2@info.uah.edu>, Greg Bacon <gbacon@cs.uah.edu> wrote:
>In article <6sib5t$avt$1@monet.op.net>,
> mjd@op.net (Mark-Jason Dominus) writes:
>: Use `index' instead of using a regular expression.
>
>Why? Shouldn't the regex engine be smart enough to do Boyer-Moore
>when its pattern is a constant?
I was not suggesting `index' for performance reasons. I was
suggesting it because it provides the functionality that the original
poster wanted.
I am going to make a bold prediction now. With ten years, we are
going to discover that the kind of performance typically measured by
these `benchmark' tests is irrelevant to the real performance of real
Perl programs, and in fact is exactly the sort of micro-optimization
that everyone already says you should avoid.
------------------------------
Date: Wed, 2 Sep 1998 08:19:06 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Newbie RE Question
Message-Id: <MPG.105701c5e285ad198981d@nntp.hpl.hp.com>
In article <6sjlp6$dfj$1@monet.op.net> on 2 Sep 1998 10:47:02 -0400,
Mark-Jason Dominus <mjd@op.net> says...
> In article <6sjkie$8t$2@info.uah.edu>, Greg Bacon <gbacon@cs.uah.edu> wrote:
> >In article <6sib5t$avt$1@monet.op.net>,
> > mjd@op.net (Mark-Jason Dominus) writes:
> >: Use `index' instead of using a regular expression.
> >
> >Why? Shouldn't the regex engine be smart enough to do Boyer-Moore
> >when its pattern is a constant?
>
> I was not suggesting `index' for performance reasons. I was
> suggesting it because it provides the functionality that the original
> poster wanted.
>
> I am going to make a bold prediction now. With ten years, we are
> going to discover that the kind of performance typically measured by
> these `benchmark' tests is irrelevant to the real performance of real
> Perl programs, and in fact is exactly the sort of micro-optimization
> that everyone already says you should avoid.
It all depends.
I have a long-running real Perl program whose main task is pawing through
many thousands of lines of the form "f1\tf2\n" and counting all the
occurrences of 'f1' by bumping entries in a hash on 'f1'. I tried
$f1 = (split /\t/)[0];
and
($f1) = /([^\t]+)/;
and ended up with the odd and rather verbose form:
$f1 = substr $_, 0, index $_, "\t";
This cut more than 30% off the running time of the program! How would I
have come up with that choice without Benchmark tests (and clues from
this newsgroup that 'substr' and 'index' are fast)?
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Wed, 02 Sep 1998 14:59:30 GMT
From: NukeEmUp@ThePentagon.com (David Cantrell)
Subject: Re: Perl & Java - differences and uses
Message-Id: <35ed5a9a.78840005@thunder>
On Wed, 2 Sep 1998 12:46:46 +0100,
"Jim" <-> enlightened us thusly:
>As a young(17) and budding internet page designer I have often been told
>"forget the rest, learn Java" when asking about programming for the net,
Whoever told you that was a fool.
>this is also the message Internet magazines tend to give.
Mass-market magazines aren't exactly renowned for being the fount of
all wisdom and knowledge ;-)
> However having
>recently been learning Perl(and loving it) I am curious as to the power Java
>has over Perl
In some areas, perl is very strong (particularly text handling) and
java is weak. In others, java is very strong (for instance, GUIs) and
perl is weak.
And before anyone jumps on me, yes I _am_ aware of perl/tk - and of
com.stevesoft.pat and oromatcher for doing regexes in java.
> what the main uses are and the main differences are, will
>Perl eventually be replaced by Java?
No. For the same reason as why fish will never replace squid in the
oceans. They inhabit different environmental niches - although there
is some overlap.
I've found that for little tasks you would consider a SCRIPT (such as
something to quickly munge a logfile, or a CGI) I tend to use perl.
For tasks which I would consider to be an APPLICATION, such as a
listserv or a Usenet client, I use java.
Certainly for large projects (10,000 lines (ish) or more), java wins
hands down because it is strongly typed and positively encourages the
use of inheritance, encapsulation, and all the other OO goodies.
For small projects, and especially for one-off tasks, perl gets my
vote, as in the time it takes to bang together ten quick n' dirty
lines and run them I might just about be able to write my class
declarations and import the right packages in java.
--
Dave, who has been accused of writing perl as if it were java.
I'll take that as a compliment even if it wasn't meant as one.
------------------------------
Date: Wed, 02 Sep 1998 15:02:52 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: Perl & Java - differences and uses
Message-Id: <w6dH1.104$kE2.954612@news.shore.net>
yong (yong@shell.com) wrote:
: On the other hand, the Java people don't like Perl mainly because Perl looks
: "ugly" and "cryptic" at first sight.
class WTF {
public mane hairy cat implements SexyPimple in an impureFashion {
// more stuff
}
}
So the above is very clear? :-)
--
Nate Patwardhan|root@localhost
"Fortunately, I prefer to believe that we're all really just trapped in a
P.K. Dick book laced with Lovecraft, and this awful Terror Out of Cambridge
shall by the light of day evaporate, leaving nothing but good intentions in
its stead." Tom Christiansen in <6k02ha$hq6$3@csnews.cs.colorado.edu>
------------------------------
Date: Wed, 02 Sep 1998 15:02:29 GMT
From: NukeEmUp@ThePentagon.com (David Cantrell)
Subject: Re: Perl & Java - differences and uses
Message-Id: <35ee5d72.79567341@thunder>
In my previous post, I should have pointed out that if you want to
program for the net (as opposed to just for the www part of it) you
should learn C(\+{2})+ as well as perl.
--
Dave, who counts himself lucky that he doesn't have to
use C/C++ all that often. perl's far more fun.
------------------------------
Date: Wed, 02 Sep 1998 15:28:15 GMT
From: NukeEmUp@ThePentagon.com (David Cantrell)
Subject: Re: Perl & Java - differences and uses
Message-Id: <35ed62ec.80969327@thunder>
On Wed, 02 Sep 1998 15:02:52 GMT,
nvp@shore.net (Nathan V. Patwardhan) enlightened us thusly:
>yong (yong@shell.com) wrote:
>
>: On the other hand, the Java people don't like Perl mainly because Perl looks
>: "ugly" and "cryptic" at first sight.
>
>class WTF {
> public mane hairy cat implements SexyPimple in an impureFashion {
> // more stuff
> }
>}
>
>So the above is very clear? :-)
Clearer than
local @mths=split(/ /,
'Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec');
$when=~s/(\d+)-0*(\d+)-0*(\d+)/$3 $mths[$2-1] $1/;
:-)
--
David Cantrell, part-time NT/java/SQL techie
full-time chef/musician/homebrewer
http://www.ThePentagon.com/NukeEmUp
------------------------------
Date: Wed, 02 Sep 1998 11:35:51 -0400
From: joe.mcmahon@gsfc.nasa.gov (Joe McMahon)
Subject: Re: Perl compiler
Message-Id: <joe.mcmahon-0209981135520001@prtims.stx.com>
What I'm failing to understand is this.
We'll assume for the sake of argument, that your software is perfect and
will never need maintenance, upgrades or support; that it will not be used
in a business-critical application in which it is crucial to the company
which is using it to have it fixed fast if it breaks; and that there is no
need to train people in how to use it, or to write books illustrating its
proper application in a wide range of areas.
Now that we have these methods of profiting from the program out of the
way -- maintenance, support, training, and documentation -- let's talk
about the one remaining key point I haven't seen mentioned.
Why, if you have created software system X, investing a lot of money in
programmer time, facilities, etc., and believe that software system X is
worth more money, do you not think investing in a few hours of lawyer time
to have a licensing agreement drawn up is a good idea? If the program is
really good, you should be able to get people to pretty near sign their
souls away to use it. (I remember IBM's licensing agreements for MVS/ESA
-- not only did you not get source, but you were forbidden, on pain of
having IBM come in and remove the OS from your machine, from trying to
decompile it.)
People are less likely to try to get around a licensing agreement, because
breaking a licensing agreement and getting caught will cost them money --
they could, for instance, lose access to the software, making their
investment in it a loss. Companies HATE losses. They could end up paying
you a lot of money in court. Companies HATE being sued and losing.
Breaking a security method -- whatever method -- will not cost them any
money, unless there is a specific agreement that says they know that they
are breaking a contract with you if they even try it.
--- Joe M.
------------------------------
Date: Wed, 02 Sep 1998 10:32:57 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: Perl Cookbook, does anyone have it?
Message-Id: <fl_aggie-0209981032570001@aggie.coaps.fsu.edu>
In article <35EABE04.7AACA0CD@min.net>, John Porter <jdporter@min.net> wrote:
+ lard (Llama lard is recommended, if available)
+
+ ...fry in lard...fry in lard...Fry the onions in lard...baste
+ frequently lard.
Arteries.....clogggggiiiiinnnngggggg.....must....escape.....
*ack*
------------------------------
Date: Wed, 02 Sep 1998 09:18:44 -0500
From: yong <yong@shell.com>
To: Jay Bartelt <bartelt@enteract.com>
Subject: Re: Perl DBI vs. LiveWire
Message-Id: <35ED53C4.6CDF3373@shell.com>
It seems there're not many people using LiveWire any more. I don't know if
it's really good in performance but I don't think you can run it on any
server other than Netscape. Perl is good at least in the sense that it's
more portable.
Have you posted a message to a Netscape newsgroup such as
netscape.dev.livewire.programming?
Yong Huang
------------------------------
Date: Wed, 02 Sep 1998 15:48:11 GMT
From: Elaine -HappyFunBall- Ashton <eashton@bbnplanet.com>
Subject: Re: Perl DBI vs. LiveWire
Message-Id: <35ED6666.C0F2D76E@bbnplanet.com>
it really depends on what kind of machine its on, etc. but, i will say
flatly that i LOATHE livewire. its cool when it works but sucks majorly
when it doesn't. we have worked with so many customers who have mangled
livewire beyond belief and caused more problems than its worth. you
should probably write up 2 models, one with perl dbi and one with
livewire. if you use livewire use the pools as opposed to
opening/closing the connection to the db every time. also, livewire is
buggy. i forget what patch level they are in now but if you have
customer support, request the latest and greatest version. dbi with
oracle works great.
e.
------------------------------
Date: Wed, 2 Sep 1998 14:29:09 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Perl version
Message-Id: <EynuwL.JHC@world.std.com>
maurice@hevanet.com (Maurice Aubrey) writes:
>On 31 Aug 1998 11:52:25 GMT, Stefan Scholl <stesch@parsec.inka.de> wrote:
>>There're some reasons to use perl4.
>>
>>Sometimes size matters.
>However, we should all remember what Randal Schwartz told us back
>in March:
>>The "suidperl security patch" fixes only one class of buffer overflow
>>problems that were found in 5.002, and fixed in 5.003 (with the patch
>>retrofitted to 4.036). *Additional* buffer overflows were found in
>>5.003 during the 5.004 release cycle, and subsequently patched in
>>5.004. THESE PATCHES were NOT backported to 4.036. There exists NO
>>PATCHES to remove all known security holes in 4.036.
Not that I'm recomending anyone to create new scripts under perl 4,
but problems found in suidperl doesn't necessarily mean that perl 4
should stop being used (for backwards compatibility with existing
scripts written with that version of the language.) Just the setuid
option.
Since most of the scripts that people run are not setuid, missing that
feature is only a minimal inconvenience.
--
Andrew Langmead
------------------------------
Date: 12 Jul 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Mar 98)
Message-Id: <null>
Administrivia:
Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.
If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu.
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 3617
**************************************