[17717] in Perl-Users-Digest
Perl-Users Digest, Issue: 5137 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Dec 18 03:05:39 2000
Date: Mon, 18 Dec 2000 00:05:15 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <977126714-v9-i5137@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Mon, 18 Dec 2000 Volume: 9 Number: 5137
Today's topics:
Re: Ada feature borrowed for Perl?? (Tom Christiansen)
basic package question <news@#nospam#althepal.com>
Re: basic package question (Abigail)
Re: Better way to remove lines from output? (Chris Fedde)
Re: creating a file (Tom Christiansen)
Re: Getting around named pipe blocking? (Gregory Spath)
Re: Getting around named pipe blocking? <uri@sysarch.com>
Re: Getting around named pipe blocking? <joe+usenet@sunstarsys.com>
hard references - hash of arrays - tutorial? cliverholloway@my-deja.com
Re: hard references - hash of arrays - tutorial? <uri@sysarch.com>
Hiding source <gmercille@videotron.ca>
Re: Hiding source <samuel@knm-e.se>
Re: How to make LWP::UserAgent "frame enabled" <carlywu@yahoo.com>
Re: How to make LWP::UserAgent "frame enabled" <jbuff1856@my-deja.com>
Re: Is a Hash of Arrays possible? (Martien Verbruggen)
Re: Is there an overhead using long variable names? (Abigail)
Re: Is there an overhead using long variable names? (Ben Okopnik)
Re: Is there an overhead using long variable names? (Chris Fedde)
Re: Language evolution C->Perl->C++->Java->Python (Is P (Tramm Hudson)
Re: Language evolution C->Perl->C++->Java->Python (Is P <joncruz@geocities.com>
Re: Language evolution C->Perl->C++->Java->Python (Is P <NoSpam@home.com>
Re: Language evolution C->Perl->C++->Java->Python (Is P <arnet@hpcvplnx.cv.hp.com>
Re: MLDBM? adding/modifying records? <bwalton@rochester.rr.com>
Re: More and More OT: Ramblings <bowman@montana.com>
Re: NEED HELP ! - Trying to Search/Display info from ar (Chris Fedde)
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 17 Dec 2000 16:29:25 -0700
From: tchrist@perl.com (Tom Christiansen)
Subject: Re: Ada feature borrowed for Perl??
Message-Id: <3a3d4c55@cs.colorado.edu>
In article <91jblb$7ti$1@hermes.nz.eds.com>,
Peter Sundstrom <peter.sundstrom@eds.com> wrote:
>The Bourne shell family has the very similar 'elif'
http://foldoc.doc.ic.ac.uk/foldoc/foldoc.cgi?Algol-68
ALGOL 68
<language> An extensive revision of ALGOL 60 by Adriaan van
Wijngaarden et al. ALGOL 68 was discussed from 1963 by Working
Group 2.1 of IFIP. Its definition was accepted in December 1968.
ALGOL 68 was complex, and posed difficulties for both implementors
and users. It featured structural equivalence; automatic type
conversion ("coercion") including dereferencing; flexible arrays;
generalised loops (for-from-by-to-while-do-od), if-then-elif-fi,
an integer case statement with an 'out' clause; skip and goto
statements; blocks; procedures; user-defined operators; procedure
parameters; concurrent execution (cobegin/coend); semaphores;
generators "heap" and "loc" for dynamic allocation. It had no
abstract data types or separate compilation.
--tom
------------------------------
Date: Mon, 18 Dec 2000 00:07:35 GMT
From: Alex Hart <news@#nospam#althepal.com>
Subject: basic package question
Message-Id: <bzc%5.3044$TC3.890029@typhoon2.ba-dsg.net>
I am starting to convert some code to mod_perl, and I've decided that
the best way to do it is to fully qualify all my variables. I've
realized that my understanding of packages is worse than I thought.
Below is a very simple example and some questions.
1. In the code below, why doesn't $Testpack::testvar refer to the
$testvar declared above it?
2. Are packages automatically created when they are refered to? Do I
need to specify a package at all?
3. Does the package name matter at all? Should I just use "main" for
everything?
4. (very subjective question) Is this my best bet for converting to
mod_perl. I have a ton of variables shared by subroutines, and I can't
see passing them back and forth. How do I know if I'm better off
declaring global variables? Is that a big waste of memory?
#!/usr/bin/perl
use strict;
package Testpack;
my $testvar = 4;
&Routine;
sub Routine {
print $Testpack::testvar + 1,"\n";
}
Thanks in advance.
--
- Alex Hart
$j="592888088758319859281631592858792919873179698955";
$p="push\@_,";$c="chop(\$_)";$_="$p$p($c.$c)+19;eval;
+".$j;eval;%_=map{chr}reverse@_;foreach(sort+keys%_){print$_{$_}}
------------------------------
Date: 18 Dec 2000 01:41:02 GMT
From: abigail@foad.org (Abigail)
Subject: Re: basic package question
Message-Id: <slrn93qqpe.rit.abigail@tsathoggua.rlyeh.net>
Alex Hart (news@#nospam#althepal.com) wrote on MMDCLXVI September
MCMXCIII in <URL:news:bzc%5.3044$TC3.890029@typhoon2.ba-dsg.net>:
|| I am starting to convert some code to mod_perl, and I've decided that
|| the best way to do it is to fully qualify all my variables. I've
|| realized that my understanding of packages is worse than I thought.
|| Below is a very simple example and some questions.
||
|| 1. In the code below, why doesn't $Testpack::testvar refer to the
|| $testvar declared above it?
Because $Testpack::testvar refers to the variable '$testvar' in the
package Testpack. However, the $testvar in the code is a lexical variable,
and not a package variable.
|| 2. Are packages automatically created when they are refered to? Do I
|| need to specify a package at all?
Packages are just name spaces; don't think of them as being "created".
The aren't "created" on a languge level. And you don't need to specify
packages at all.
|| 3. Does the package name matter at all? Should I just use "main" for
|| everything?
The package name doesn't matter. Whether you should use "main" for
everything depends on the problem.
|| 4. (very subjective question) Is this my best bet for converting to
|| mod_perl. I have a ton of variables shared by subroutines, and I can't
|| see passing them back and forth. How do I know if I'm better off
|| declaring global variables? Is that a big waste of memory?
I don't see the relevance of mod_perl here. As for passing around
information between subroutines, that's what you have function arguments
for; usually, one doesn't use global variables too often, although the
"never ever use global variables" seems like very 80's to me.
||
|| #!/usr/bin/perl
|| use strict;
|| package Testpack;
|| my $testvar = 4;
|| &Routine;
|| sub Routine {
|| print $Testpack::testvar + 1,"\n";
|| }
Abigail
--
perl -MLWP::UserAgent -MHTML::TreeBuilder -MHTML::FormatText -wle'print +(
HTML::FormatText -> new -> format (HTML::TreeBuilder -> new -> parse (
LWP::UserAgent -> new -> request (HTTP::Request -> new ("GET",
"http://work.ucsd.edu:5141/cgi-bin/http_webster?isindex=perl")) -> content))
=~ /(.*\))[-\s]+Addition/s) [0]'
------------------------------
Date: Mon, 18 Dec 2000 00:56:54 GMT
From: cfedde@fedde.littleton.co.us (Chris Fedde)
Subject: Re: Better way to remove lines from output?
Message-Id: <qhd%5.298$B9.188720128@news.frii.net>
In article <gq7f3tseiop8snfa3cgh67v8s8u359fhhj@4ax.com>,
Bart Lateur <bart.lateur@skynet.be> wrote:
>Odd_Carnivals@yahoo.com wrote:
>
>>Your code chomps the last line of the file rather than
>>the next-to-last (which is what my code does). Any
>>thoughts on the best way to chomp the next-to-last?
>
>Always chomp, and prepend "\n" to every line before printing it out,
^^^^^^^
I expect that you want postpend there.
>except for the very first and the last line.
>
Oh! So that IS what you are proposing. Very odd.
chris
--
This space intentionally left blank
------------------------------
Date: 17 Dec 2000 16:20:33 -0700
From: tchrist@perl.com (Tom Christiansen)
Subject: Re: creating a file
Message-Id: <3a3d4a41@cs.colorado.edu>
In article <slrn93qc66.2sk.tadmc@magna.metronet.com>,
Tad McClellan <tadmc@metronet.com> wrote:
>But I never ever write a single program that relys on autoclose.
Disbelieve: perl -n, perl -p, or anything with <ARGV>.
>I once spent 6 hours troubleshooting a problem that was
>solved by using an explicit close.
For me, it was $. (not) resetting.
--tom
------------------------------
Date: Sun, 17 Dec 2000 23:17:48 -0000
From: gspath@freefall.homeip.net (Gregory Spath)
Subject: Re: Getting around named pipe blocking?
Message-Id: <slrn93qib3.clb.gspath@freefall.homeip.net>
In <m3bsuasnvp.fsf@mumonkan.sunstarsys.com>, Joe Schaefer (joe+usenet@sunstarsys.com) wrote:
>gspath@freefall.homeip.net (Gregory Spath) writes:
>
>> The way I tried to get around the blocking nature of the
>> FIFO (named pipe) was to fork it off as its own process.
>
>I didn't see any FIFO in the code you wrote, but you can get
>around FIFO's blocking on open calls by opening with O_RDWR
>set either with sysopen or open with <+ or >+ prefixes -
I tried the <+, and it didn't work. I'm on linux. You didn't see the
opens because I didn't include the whole program. I'll look into the O_RDWR,
thanks!
<SNIP>
>
>Uncomment the local $|=1 line and see if it makes
>any difference in your program.
I'll try that too. Thanks for your help! I'll post again, hopefully with good
results :) If not, I guess it's time to start working with domain sockets.
>
>Usually STDOUT is line-buffered to the terminal and
>block-buffered otherwise- see
>
>% man perlvar
>% man perlipca
Thanks for the doc pointers.
-- Greg
--
Gregory Spath
gspath@freefall.homeip.net http://freefall.homeip.net/
SCHeckler on IRC ----------> http://freefall.homeip.net/javairc/
Team YBR ------------------> http://www.yellowbreechesracing.org/
------------------------------
Date: Sun, 17 Dec 2000 23:21:48 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Getting around named pipe blocking?
Message-Id: <x7lmtefxbo.fsf@home.sysarch.com>
>>>>> "JS" == Joe Schaefer <joe+usenet@sunstarsys.com> writes:
JS> # local $| = 1;
JS> Uncomment the local $|=1 line and see if it makes
JS> any difference in your program.
local on $| is meaningless as the value is file handle specific. the
currently selected (1 arg select) file handle autoflush flag gets set or
cleared when you assign to $|.
beyond that (i haven't looked at the code in detail), make sure all your
sockets are non-blocking. even if you write to a socket/pipe on one
side, you may not be able to read on the other unless you read less or
equal than what is in the pipe. this is a big issue with socket
management in general. you can simplify things with some form of
protocol and read until the record boundary but that will block
sometimes.
check out the perl cookbook for more on non-forking servers.
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page ----------- http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net ---------- http://www.northernlight.com
------------------------------
Date: 17 Dec 2000 19:37:50 -0500
From: Joe Schaefer <joe+usenet@sunstarsys.com>
Subject: Re: Getting around named pipe blocking?
Message-Id: <m37l4ysgwx.fsf@mumonkan.sunstarsys.com>
gspath@freefall.homeip.net (Gregory Spath) writes:
> I tried the <+, and it didn't work.
That wouldn't work, cause it's backwards- I should have wrote "+<",
but I misremembered the proper order. Sorry about that :(- check
% perldoc -f open
% perldoc -q open
for the right way. However, I doubt it's relevant to your problem,
since you don't seem to be using FIFOs. I would look into the
autoflush on STDOUT. As Uri remarked in another post, the "local"
statement is superfluous in this context, but force of habit prevails
again :)
> >Usually STDOUT is line-buffered to the terminal and
> >block-buffered otherwise- see
> >
> >% man perlvar
> >% man perlipca
^
% man perlipc
Good luck.
--
Joe Schaefer
------------------------------
Date: Mon, 18 Dec 2000 06:25:21 GMT
From: cliverholloway@my-deja.com
Subject: hard references - hash of arrays - tutorial?
Message-Id: <91kake$1l5$1@nnrp1.deja.com>
hi,
I'm trying to come to grips with hard references and wondered if anyone knew
of a good tutorial?
Specifically, I'm trying to find out how to keep strict happy in this
instance:
%hash is a hash of arrays.
I'm then trying to iterate through it like this:
my $key;
foreach $key (keys %hash) {
print "\n$key: ";
foreach (@{$hash{$key}}) {
print "$_ - ";
}
}
If I use "no strict 'refs'" it works, but if I don't I get the error:
Can't use string ("0") as an ARRAY ref while strict refs in use.
Does anyone have a _simple_ explanation of what I need to do to maker this
work under strict?
One day, I'm sure this will sink in...
later
cLive ;-)
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Mon, 18 Dec 2000 06:47:02 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: hard references - hash of arrays - tutorial?
Message-Id: <x7g0jmfcpl.fsf@home.sysarch.com>
>>>>> "c" == cliverholloway <cliverholloway@my-deja.com> writes:
c> %hash is a hash of arrays.
is it really?
c> my $key;
c> foreach $key (keys %hash) {
foreach my $key
c> print "\n$key: ";
print the hash value too. you might be suprised what you find.
c> foreach (@{$hash{$key}}) {
c> Can't use string ("0") as an ARRAY ref while strict refs in use.
well, that means you don't have an array ref there. so your statement
above must be false. how did you populate the hash?
read perlreftut, perlref, perldsc, perllol
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page ----------- http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net ---------- http://www.northernlight.com
------------------------------
Date: Mon, 18 Dec 2000 02:05:54 -0500
From: Mercille <gmercille@videotron.ca>
Subject: Hiding source
Message-Id: <3A3DB752.301F9992@videotron.ca>
I heard that it was impossible to totally hide the source of a script
written in perl. I kinda agree with that, since the script has to be
world-read+execute, but still, I haven't figured out a way to read my
own source from the web. I'm no professional hacker, but I would like
to know how they can do this to see what kind of security measures I can
take.
Please try and get the source of
http://www.info.polymtl.ca/~sleeping/cgi-bin/test.cgi and if you can see
the source, tell me how you did it (using which software, which
strategy, etc.) Thanks a lot.
------------------------------
Date: Mon, 18 Dec 2000 08:37:12 +0100
From: "Samuel Rydén" <samuel@knm-e.se>
Subject: Re: Hiding source
Message-Id: <haj%5.4971$r42.11633@nntpserver.swip.net>
Mercille <gmercille@videotron.ca> wrote in message
news:3A3DB752.301F9992@videotron.ca...
> I heard that it was impossible to totally hide the source of a script
> written in perl. I kinda agree with that, since the script has to be
> world-read+execute, but still, I haven't figured out a way to read my
> own source from the web. I'm no professional hacker, but I would like
> to know how they can do this to see what kind of security measures I can
> take.
Is it true?
Doesn't that like depend on your web server configuration for your script's
directory?
- Samuel
------------------------------
Date: Fri, 15 Dec 2000 18:03:05 +1100
From: "Carl Wu" <carlywu@yahoo.com>
Subject: Re: How to make LWP::UserAgent "frame enabled"
Message-Id: <3a3d67c4$0$19416$7f31c96c@news01.syd.optusnet.com.au>
Peter,
You are right.
But the page I got can't be display by my browser (IE5), while I can use my
browser to view that site on internet.
Can you try point your browser to "http://www.tradingroom.com.au",
then use standard perl tool "GET http://www.trading.room.au >whatever.html",
the page "whatever.html" can't be opened by the browser!
What can be the reason?
Thanks a lot.
Carl Wu
Peter Scott wrote in message ...
>In article <3a38596f$0$15828$7f31c96c@news01.syd.optusnet.com.au>,
> "Carl Wu" <carlywu@yahoo.com> writes:
>>Hi Tony,
>>
>>Yes the document I got back has been processed by the server locally, it
>>return a page tell me how to upgrade my browser with links to Microsfot
and
>>Netscape.
>>I did try to call $ua->agent("Mozilla 5.0") and various agent ID(s) but it
>>didn't help.
>>Is it possible that the server didn't rely on the UserAgent Id but because
>>it detects the client is not capable of understanding frames during the
>>conversation between the server and the client?
>
>No. The only way it is likely to infer such ability is through the value
of the
>UserAgent header.
>
>Almost certainly you are not looking at the entire content that is being
returned.
>It is traditional for framesets to also include the text you are seeing;
>browsers that don't understand frames will display that text; browsers that
do,
>display the frames.
>
>And this has nothing to do with Perl... followups altered.
>
>--
>Peter Scott
------------------------------
Date: Mon, 18 Dec 2000 03:42:16 GMT
From: jbuff <jbuff1856@my-deja.com>
Subject: Re: How to make LWP::UserAgent "frame enabled"
Message-Id: <91k12o$qkc$1@nnrp1.deja.com>
In article <3a3d67c4$0$19416$7f31c96c@news01.syd.optusnet.com.au>,
"Carl Wu" <carlywu@yahoo.com> wrote:
> Peter,
>
> You are right.
> But the page I got can't be display by my browser (IE5), while I can
use my
> browser to view that site on internet.
> Can you try point your browser to "http://www.tradingroom.com.au",
> then use standard perl tool "GET http://www.trading.room.au
>whatever.html",
> the page "whatever.html" can't be opened by the browser!
> What can be the reason?
>
> Thanks a lot.
>
If you open whatever.html in a text editor, you might find out.
--jbuff
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Mon, 18 Dec 2000 01:48:20 GMT
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Is a Hash of Arrays possible?
Message-Id: <slrn93qr32.j5f.mgjv@verbruggen.comdyn.com.au>
[Please, by now you SHOULD know not to post upside down in this group.
Put your replies _after_ the text you reply to.]
On Sat, 16 Dec 2000 02:03:52 GMT,
John Boy Walton <johngros@Spam.bigpond.net.au> wrote:
> "Tom Christiansen" <tchrist@perl.com> wrote in message
> news:3a3a42e1$1@cs.colorado.edu...
>> In article <3a39e95c@news-uk.onetel.net.uk>, Edd <edd@texscene.com> wrote:
>> What part of the perlref, perldsc, or perllol manpages was it
>> that you didn't understand? :-(
>>
> I thought perllol was just perl jokes!?!?
Perl programmers have no sense of humour. There are no jokes about
Perl.
Martien
--
Martien Verbruggen |
Interactive Media Division | 42.6% of statistics is made up on the
Commercial Dynamics Pty. Ltd. | spot.
NSW, Australia |
------------------------------
Date: 18 Dec 2000 01:10:57 GMT
From: abigail@foad.org (Abigail)
Subject: Re: Is there an overhead using long variable names?
Message-Id: <slrn93qp11.qq1.abigail@tsathoggua.rlyeh.net>
On 16 Dec 2000 19:25:52 GMT, Ben Okopnik (fuzzybear@pocketmail.com) wrote in comp.lang.perl.misc <URL: news:<slrn93ngi2.t6d.fuzzybear@Odin.Thor>>:
++
++ And now, a message from one of the little programmers... :\
++
++ Can anyone recommend a "general principles of programming" book that would
++ talk about about this kind of stuff? I mean, avoiding the bad practices
++ and using the good ones, not even necessarily WRT a specific language (and
++ if it has to be specific, preferably Perl.) I've been cranking out code
++ for <mumble-mumble> years now, in close to a dozen different languages -
++ but it's been mostly a "learn as you go" experience, though I've written
++ some fair-sized apps. I knew about "efficiency-chasing", but I'm not so
++ sure about other pitfalls.
Well, there's Knuth, of course.
And that's all you need.
Abigail
------------------------------
Date: 18 Dec 2000 01:28:48 GMT
From: fuzzybear@pocketmail.com (Ben Okopnik)
Subject: Re: Is there an overhead using long variable names?
Message-Id: <slrn93qq3h.qcg.fuzzybear@Odin.Thor>
The ancient archives of 18 Dec 2000 01:10:57 GMT showed
Abigail of comp.lang.perl.misc speaking thus:
>On 16 Dec 2000 19:25:52 GMT, Ben Okopnik (fuzzybear@pocketmail.com) wrote in comp.lang.perl.misc <URL: news:<slrn93ngi2.t6d.fuzzybear@Odin.Thor>>:
>++
>++ And now, a message from one of the little programmers... :\
>++
>++ Can anyone recommend a "general principles of programming" book that would
>++ talk about about this kind of stuff? I mean, avoiding the bad practices
>++ and using the good ones, not even necessarily WRT a specific language (and
>++ if it has to be specific, preferably Perl.) I've been cranking out code
>++ for <mumble-mumble> years now, in close to a dozen different languages -
>++ but it's been mostly a "learn as you go" experience, though I've written
>++ some fair-sized apps. I knew about "efficiency-chasing", but I'm not so
>++ sure about other pitfalls.
>
>
>Well, there's Knuth, of course.
>
>And that's all you need.
I keep *meaning* to look into that. F'ghod's sake, the local library
should have it. <frustrated *snort* at my own forgettery>
Thanks.
Ben Okopnik
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
It is human nature to hate him whom you have injured. -- Tacitus
------------------------------
Date: Mon, 18 Dec 2000 05:19:04 GMT
From: cfedde@fedde.littleton.co.us (Chris Fedde)
Subject: Re: Is there an overhead using long variable names?
Message-Id: <c7h%5.304$B9.187360768@news.frii.net>
In article <slrn93ngi2.t6d.fuzzybear@Odin.Thor>,
Ben Okopnik <fuzzybear@pocketmail.com> wrote:
>The ancient archives of 15 Dec 2000 10:12:00 -0700 showed
>Tom Christiansen of comp.lang.perl.misc speaking thus:
>>
>> Rule 1 of optimization is: Don't!
>
I first saw this attributed to Michael Jackson (not that Michael Jackson)
of Michael Jackson Systems Ltd. In Jon Bently's fantastic volume _More
Programming Pearls_
[The First Rule of Program Optimization] Don't do it.
[The Second Rule of Program Optimization -- For Experts Only]
Don't do it yet.
Great book. Should be on every programmers desk. (ISBN 0-201-11889-0)
>
>And now, a message from one of the little programmers... :\
>
>Can anyone recommend a "general principles of programming" book that would
>talk about about this kind of stuff? I mean, avoiding the bad practices
>and using the good ones, not even necessarily WRT a specific language (and
Here is my short list...
Programming Pearls, Jon Bentley, isbn 0-201-10331-1
More Programming Pearls, John Bentley isbn 0-201-11889-0
Algorithms + Data Structures = Programs, Nicklaus Wirth isbn 0-13-022418-9
The Practice of Programming, Kernighan & Pike, isbn 0-201-61586-X
The Mythical Man Month, Frederick Brooks, Jr. isbn 0-201-83595-9
Beyond Calculation, Edited by Peter Dennings & Robert Metcalfe
isbn 0-387-98588-3
Godel, Escher, Bach, Douglas Hofstadter, isbn 0-394-74502-7
Algorithms, Sedgewick, isbn 0-201-06672-6
Extreme Programming Explained, Kent Beck, isbn 0-201-61641-6
And, as always, read and study the code of other programmers.
chris
--
This space intentionally left blank
------------------------------
Date: 18 Dec 2000 00:28:31 GMT
From: hudson@swcp.com (Tramm Hudson)
Subject: Re: Language evolution C->Perl->C++->Java->Python (Is Python the ULTIMATE oflanguages??)
Message-Id: <91jlnf$hfj$1@sloth.swcp.com>
[newsgroups trimmed to just the perl group]
Chris Fedde <cfedde@fedde.littleton.co.us> wrote:
>Just Me <just_me@nowhere.com> wrote:
>>Try writing this in your favourite language:
>>
>> 1000 factorial
>> -> a very large number which causes overflow if
>> not evaluated in Smalltalk
Sure, how about dc:
# echo 1000 | time dc -e '[d1-d1<f*]sf?lfxp'
402387260077093773543702433923003985719374864210714632543799910429938\
....
000000000000000000000000000000000000000000000000000000000000000000000\
000000000000000
0.69user 0.01system 0:00.78elapsed 89%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (93major+82minor)pagefaults 0swaps
>Here is one in perl...
> ...
>It's not very fast though:
>
> real 0m10.433s
> user 0m10.104s
> sys 0m0.033s
>
>Ruby seems to be able to do it much faster...
> ...
>real 0m0.129s
>user 0m0.086s
>sys 0m0.034s
Not too shaby in comparison...
>Both output what I suspect is the correct value...
>
>4023872600770937735437024339230039857193748642107146325437999104299385123986290
They seem to agree with the first few digits, and the last ones, too.
Tramm
--
o hudson@swcp.com hudson@turbolabs.com O___|
/|\ http://www.swcp.com/~hudson/ H 505.323.38.81 /\ \_
<< KC5RNF @ N5YYF.NM.AMPR.ORG W 505.986.60.75 \ \/\_\
0 U \_ |
------------------------------
Date: Sun, 17 Dec 2000 16:03:45 -0800
From: "Jon A. Cruz" <joncruz@geocities.com>
Subject: Re: Language evolution C->Perl->C++->Java->Python (Is Python the ULTIMATE oflanguages??)
Message-Id: <3A3D5461.6ADD64B2@geocities.com>
Chris Smith wrote:
> Yes, Python is a fairly well-known, though fairly new, language. Don't
> judge the entire Python language by what some moron posts on USENET. Just
> ignore the thread and let it die... don't feul it.
Strange...
I had heard of it back near when my company started doing Java back in '95.
Even had one guy who did most of his Java programming in Python. Very fast &
low-bug guy at that.
No that new at all.
(Oh, and there's JPython, so it's not even true that it has to be in C.
Another of his arguments that trips up on the details).
------------------------------
Date: Mon, 18 Dec 2000 07:59:18 GMT
From: Titan <NoSpam@home.com>
Subject: Re: Language evolution C->Perl->C++->Java->Python (Is Python the ULTIMATE of languages??)
Message-Id: <3A3DC3D0.7605E261@home.com>
Roedy Green wrote:
>
> ludicrous it yanks the rug out from under your credibility. Everything
> else you have claimed is now suspect, even the stuff that is true,
> e.g. that Python is terser and more readable.
Well it seems your position is a little extreme, if not ludicrous to
brand EVERYTHING someone claims as suspect just because of a
disagreement on one issue.
-- Titan
------------------------------
Date: 18 Dec 2000 05:15:06 GMT
From: <arnet@hpcvplnx.cv.hp.com>
Subject: Re: Language evolution C->Perl->C++->Java->Python (Is Python the ULTIMATE of languages??)
Message-Id: <91k6gq$rep$1@hpcvnews.cv.hp.com>
In comp.lang.perl Al Dev <alavoor-nospam@yahoo.com> wrote:
> Language evolution from C->Perl->C++->Java->Python (Is Python the
> ULTIMATE of
> languages??)
No. The ultimate language will be one in which I can compose a
program of a single statement that will do what I meant it to do
in the face of data different than I expected... ;-)
--arne
DISCLAIMER: These opinions and statements are those of the author and
do not represent any views or positions of the Hewlett-Packard Co.
------------------------------
Date: Mon, 18 Dec 2000 01:03:06 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: MLDBM? adding/modifying records?
Message-Id: <3A3D6255.F35E0B81@rochester.rr.com>
Bruce Wayne wrote:
>
> Thanks Bob with all my heart...
> found another one of your posts on MLDBM and i posted a reply there
> theanking you profusely for your kindassistance
>
> still wonderind about deleting records etc,,, but you gave me both
> legs in in your other post,,,, so thanks again
>
> Bruce Wayne,
...
Bruce, the same thing applies when deleting as when performing any other
modification: addition or deletion of an entire key of the tied hash
will work fine as usual; any modification to a substructure in a value
of the hash will require that the value be fetched into a temporary
structure, that structure be modified as desired, and then the temporary
structure be stored back into the tied hash. The reason for this is
that a tied hash can have only strings for values (unlike a normal hash,
which can have any scalar, including a reference, for its value). In
MLDBM, Data::Dumper, Storable, or FreezeThaw is used to convert a
substructure reference normally stored in the value to/from a string so
it may be stored in the tied hash. The only time that conversion occurs
is when a key is fetched or stored into the tied hash. If you, for
example, try to store a reference to a structure into a value of a tied
hash, you will get the stringified version of the reference -- something
like HASH(0xba5d7c) -- instead of something which can later be decoded
back into the structure you wanted to store. MLDBM alters the
stringification of the structure reference to something useful. HTH.
--
Bob Walton
------------------------------
Date: Sun, 17 Dec 2000 19:48:02 -0700
From: "bowman" <bowman@montana.com>
Subject: Re: More and More OT: Ramblings
Message-Id: <0ef%5.2196$N84.12640@newsfeed.slurp.net>
David Steuber <nospam@david-steuber.com> wrote
>
> I am guessing that Python will never replace Perl, Tcl or Java. I
> think that Java may cut into Perl though. Sun has a certification
> program for Java programmers. Are there any industry accepted
> standards for Perl, Python, or Tcl programmers? Are there any
> industry certifications for any free software?
It's cold and blowing: might as well ramble.
I, too, doubt Python will replace Perl nor do I think that is really its
purpose. I do think it is an excellent didactic language and do recommend it
to beginners over Perl, or, sigh, BASIC.
I've been wrong much more than I've been right (the Z8000 is a great
processor;
the 8086 sucks: CP/M 86 is a real OS; DOS is a toy) but I don't see Java
displacing any language. What worries me is the fact that the local U turns
out Java programmers. Twenty or so years ago, many schools churned out
Pascal programmers. Nothing against either of these languages, but
I've primarily worked in C/C++ and speak Perl with a heavy C accent. The
difference is, imho, when I work in Java, though there is a learning curve
for
the graphics packageds and so forth, I am not getting into new concepts. In
fact, I'm working with a reduced set. For someone that has only been trained
in
Java, pointers, memory management, building their own containers on the fly
in the case of C, etc etc is new ground. And new ground that is full of
anti-personnel
mines. Simplifying a language and installing training wheels is a great
idea ---
for CS101. Turning a graduate loose after four years with no other language
is something else.
Having a university cozying up to Sun is even worse. I fully realize the
heavy
educational discounts on MS software are not out of the goodness of Bill's
heart, but at least a VC++ programmer has seen some subset of C++ and
probably has dumped a little core along the way.
I'm not sure industry feels threatened by free software as much as they are
sceptical
of it. Unfortunately, Python is a good illustration of the problem. During
their recent
cha-cha with CNRI, PythonLabs and so forth, I could see a manager who had
committed
to a project using Python getting very nervous. Or putting up RH7.1 only to
find that
there are a few little issues with their version of gcc.
I'm lucky to work in a shop that takes a liberal attitude to what a
programmer uses as
long as the work gets done. However, there are two products that are loosely
related.
One, for whatever reason, is developed on NT with VC++ or VB; the group I'm
in targets
NT or AIX but develops on Linux. I have to admit the Linux group spends a
lot more
time tinkering with their boxes, building new versions of tools, and playing
around to
get things to work. The NT people load their stuff in out of shrink wrapped
boxes and
get down to work. I can see where a manager who was not really all that
savvy would
feel much more secure with the NT group. Nice, neat, uniform, and in
control. No walking
by a cubicle and seeing the latest Gnome or KDE desktop and wondering what
the hell
it was. No finding these strange little PerlTk tools lying around.
You are completely correct; in many companies management feels a lot better
throwing money
into shrink wrapped solutions than hiring talented people and giving them
free rein. Nothing
new there. It's the old chestnut: "nobody ever got fired for buying IBM"
------------------------------
Date: Mon, 18 Dec 2000 00:44:51 GMT
From: cfedde@fedde.littleton.co.us (Chris Fedde)
Subject: Re: NEED HELP ! - Trying to Search/Display info from array
Message-Id: <76d%5.296$B9.173315584@news.frii.net>
In article <915s52$rrh$1@nnrp1.deja.com>, <msalerno@my-deja.com> wrote:
>I need to search the /etc/passwd file for usernames and show all of the
>names that match the search criteria. I am still new at this and I am
>pretty sure that perls grep does not do what I need it to do. I am not
>100% sure what I need to use.
>
Getwpnam returns the same array as getpwent.
#!/usr/bin/perl -l
print join(':', getpwnam($ARGV[0]));
To list all the users using the same shell you want someting like the
following.
#!/usr/bin/perl -w
setpwent();
while (my @a = getpwent()) {
push @{$shell{$a[8]}} , $a[0];
}
for (keys %shell) {
print "$_:", join(' ', @{$shell{$_}}), "\n";
}
good luck
chris
--
This space intentionally left blank
------------------------------
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 5137
**************************************