[9798] in Perl-Users-Digest
Perl-Users Digest, Issue: 3391 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Aug 7 14:07:40 1998
Date: Fri, 7 Aug 98 11:01:47 -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 Fri, 7 Aug 1998 Volume: 8 Number: 3391
Today's topics:
re first language <simon@new-mediacom.com>
Re: re first language <jdporter@min.net>
Re: Retrieving file from REMOTE_ADDR ... HELP! <ajohnson@gpu.srv.ualberta.ca>
Re: Scoping Question <zenin@bawdycaste.org>
Re: system command <tchrist@mox.perl.com>
Re: system command (Greg Bacon)
Re: variable indirection (Craig Berry)
Re: X-file (?=...), case postponed. (Patrick Timmins)
Re: X-File was reopened, and now cancer man smokes Crac <jdporter@min.net>
Re: Year 2000 (Dustin Mollo)
Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 7 Aug 1998 17:23:59 +0100
From: Simon Wistow <simon@new-mediacom.com>
Subject: re first language
Message-Id: <645CAC0140CED111AF1500805FEDDB8A7E69@ns.new-mediacom.co.uk>
I'm probably going to get flamed my mind for this but I wouldn't
recommend Perl as a first language.
I learn't Basic on Acorn Electrons then gave up for ages before getting
into STOS basic. Then I learnt 6800 assembler then gave up again.
When I got to college (Imperial College, London) I was forced to learn a
crappy Pascal-esque language called Turing and a functional language
called Miranda (which taught me how to write tight, efficent
procedures). I also learnt 6800 (again) and programming the 68k chip in
Hex (long story, don't ask). Then I started learning 'useful' languages
like C, Pascal, Perl, Java and (unfortuantely) x86.
Although it seems like a long tortuous route I've learnt a few things
...
1) gotos are Harmful ;)
2) it's better to learn a pansy, emmasculate language like Turing first
because it teaches you how to strongly type, set out your code properly
and work around any problems a language has.
3) code written whilst on Jolt cola or drunk is generally better than
stuff you've been planning on paper for days
4) assembler (especially 6800) *is* good to learn. It taught me how to
be careful with memory and clearing up after myself whilst not producing
lines and lines of error messages over one misplace semi-colon like C
did.
When I actually got round to learning C I found it much easier because I
could start to worry about things like pointer and malloc() without
having to really think about program structure because I automatically
programmed functionally. Perl seemed a streaky peice of piss in
comparison although I found it took a while to get into the whole Perl
way of thinking. I think that had I learnt it first I would have got
myself into all sorts of trouble when I had to get into a strongly typed
language or somethign that didn't have quite so many useful functions.
Once you've learnt the fundamentals of Imperative programming then all
the other styles of programming (low and very low level Imperative
languages, scripting, Object Orientated, Functional, Event Driven,
Logic) all just seem like different ways of looking at it. And it means
you can pick up new languages *very* quickly.
I'd be interested to hear what anyone else thinks.
Haskell available from http://www.haskell.org
Turing is no longer available in the public domain
> -----Original Message-----
> From: Matt Heusser [SMTP:matt@pcr7.pcr.com]
> Posted At: Friday, August 07, 1998 12:38 PM
> Posted To: misc
> Conversation: re first language
> Subject: Re: re first language
>
>
> >Do you think at this stage of the game, that I should
> >perhaps investigate learning assembly to assist with
> >my understanding of Perl, C and other languages?
>
> Forget that. When I was in college, I took a course
> in VAX assembler, and we had to take our assembler
> code and turn it into Hex or Octal. REAL programmers
> code in Octal. ;-) <Sarcasm clearly implied>
>
> Answer - you might want to look at other languages,
> but Assembler won't be one of them until you have
> a real good grasp of C. In a lot of ways, C is just a
> different way of talking assembler that hides the details.
> <Hence people call it a "mid-level language ;>
>
> If you want to learn a nifty, ultra-easy language that
> lets you do all kindsa cool screen design and database
> (SQL or Access) stuff fast, look into visual basic. I
> think you'll find that the BASIC you programming in
> 10 years ago has turned into something more object-
> oriented and event driven. Buttons, lists, objects, forms,
> nifty stuff.
>
> If you want to write code that does cool stuff that isn't
> Screen/event driven, like extraction, reporting, CGI,
> systems administration, etc, then Perl is the Language
> for you. Y'know, in a lot of ways, Perl is just a different
> way of talking C that hides the details.
>
> good luck,
>
> Matt H.
> <Anyone else that survived CoSci 326 at Hood College,
> please say "hey" - it's too bad they killed the CoSci
> major a few years back>
>
>
>
>
> ray <ralba@distorted.net> wrote in article
> <35CA24BF.ABB78190@distorted.net>...
> > My first language was basic about 10 years ago. After coding for a
> > couple of years in that language I decided that perhaps programming
> was
> > not for me. I completely dropped the idea of programming until
> about
> > three years ago when the Internet came about. Now I am trying
> > desperately to understand Perl. For the most part it reads simple,
> > however, I sometimes find it difficult to get what I want from it
> due to
> > my lack of programming experience. And since I am self teaching
> myself,
> > I have no one to correct my mistakes.
> >
> > Do you think at this stage of the game, that I should perhaps
> > investigate learning assembly to assist with my understanding of
> Perl, C
> > and other languages?
> >
> > Also, I would like to mention, that if I could be a cook, I would be
> > very happy.
> >
> > Ray
> >
> >
------------------------------
Date: Fri, 07 Aug 1998 12:47:25 -0400
From: John Porter <jdporter@min.net>
Subject: Re: re first language
Message-Id: <35CB2F9D.2822@min.net>
Matt Heusser wrote:
>
> you might want to look at other languages,
> but Assembler won't be one of them until you have
> a real good grasp of C.
I'm not disagreeing with your advice, but I knew
assembler before I knew C, and it helped tremendously
when I was learning C. *Everything* in C made sense.
> In a lot of ways, C is just a
> different way of talking assembler that hides the details.
> <Hence people call it a "mid-level language ;>
Well, yes and that's why I call C a "low-level language".
> If you want to learn a nifty, ultra-easy language that
> lets you do all kindsa cool screen design and database
> (SQL or Access) stuff fast, look into visual basic.
Troll.
> Buttons, lists, objects, forms, nifty stuff.
> If you want to write code that does cool stuff that isn't
> Screen/event driven, like extraction, reporting, CGI,
> systems administration, etc, then Perl is the Language
> for you.
What, you've never heard of Tk?
> Y'know, in a lot of ways, Perl is just a different
> way of talking C that hides the details.
Yes, in some ways. But the difference between Perl and C
is *far* greater than the difference between C and asm.
--
John Porter
------------------------------
Date: Fri, 07 Aug 1998 11:36:12 -0500
From: Andrew Johnson <ajohnson@gpu.srv.ualberta.ca>
Subject: Re: Retrieving file from REMOTE_ADDR ... HELP!
Message-Id: <35CB2CFC.48B28F33@gpu.srv.ualberta.ca>
Hector Catre wrote:
[snip]
! Excuse me but PERL's main usefulness is as a server side
! scripting language.
you are quite mistaken about the main usefulness of the Perl
programming language.
! I just figured you guys would know just as much about CGI
! programming with Perl.
many do, many don't ... those that do might help you out on a
newsgroup involving CGI issues.
! Apparently, I stand corrected so sorry for the inconvience but I
! thought you guys knew more then you actually do.
familiar scenario: ask for help in an innappropriate forum, get
help and pointers to more appropriate resources and fora (?),
take cheap pot shots at the helpful people because you didn't
get the answer you wanted...
at least the world didn't up and change on me while I was
sleeping.
regards
andrew
------------------------------
Date: 7 Aug 1998 15:59:59 GMT
From: Zenin <zenin@bawdycaste.org>
Subject: Re: Scoping Question
Message-Id: <902506216.470922@thrush.omix.com>
[posted & mailed]
sneaker@fccj.org wrote:
: open (outfile, "mytest") or die "can't: $!";
: { # some block
: s/olddata/newdata/;
: print outfile;
: }
: close (outfile) or die "can't: $!";
Why are you trying to write to a file you've only opened for
reading?
Running this under -w would have cought the error BTW, as would
testing the return value of print().
$ perl -w foo.pl
...snip...
Filehandle main::outfile opened only for input at foo.pl line 4
--
-Zenin (zenin@archive.rhps.org) From The Blue Camel we learn:
BSD: A psychoactive drug, popular in the 80s, probably developed at UC
Berkeley or thereabouts. Similar in many ways to the prescription-only
medication called "System V", but infinitely more useful. (Or, at least,
more fun.) The full chemical name is "Berkeley Standard Distribution".
------------------------------
Date: 7 Aug 1998 16:07:55 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: system command
Message-Id: <6qf8or$djo$1@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc, Richard Kim <rkim@temple.edu> writes:
:Is there any reason why I can't do this?
:system("cp", "*.whatever", "/tmp/whatever/");
Yes, running system on a list of multiple scalars is different
from running it on one string. See the system() entry in perlfunc
and also the perlsec manpage. Actually, system() just refers
you to exec(). Ick.
--tom
--
Lispers are among the best grads of the Sweep-It-Under-Someone-Else's-Carpet
School of Simulated Simplicity. [Was that sufficiently incendiary? :-)]
--Larry Wall in <1992Jan10.201804.11926@netlabs.com
------------------------------
Date: 7 Aug 1998 16:29:15 GMT
From: gbacon@cs.uah.edu (Greg Bacon)
Subject: Re: system command
Message-Id: <6qfa0r$bdu$1@info.uah.edu>
In article <Pine.OSF.3.91.980807110716.7758A-100000@thunder.ocis.temple.edu>,
Richard Kim <rkim@temple.edu> writes:
: Is there any reason why I can't do this?
:
: system("cp", "*.whatever", "/tmp/whatever/");
:
: If I use individual files it seems to work fine, but I can't seem to use
: the wild card.
Globbing (i.e. expanding so-called wildcards) is a function of the shell
on Unix (although this isn't the case on other platforms). You can do
the globbing yourself like
system "cp", <*.whatever>, "/tmp/whatever/";
or let the shell do it like
system "cp *.whatever /tmp/whatever/";
Greg
--
A lawyer is an expert on justice in the same way that a whore is an expert on
love.
------------------------------
Date: 7 Aug 1998 16:59:55 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: variable indirection
Message-Id: <6qfbqb$ca7$3@marina.cinenet.net>
Tom Christiansen (tchrist@mox.perl.com) wrote:
: : $names{"a"} = 'good';
:
: Well, that could be single-quotes around the 'a'
: for the sake of small hobgoblins.
Or no quotes at all, for tiny kobolds. :)
---------------------------------------------------------------------
| Craig Berry - cberry@cinenet.net
--*-- Home Page: http://www.cinenet.net/users/cberry/home.html
| Member of The HTML Writers Guild: http://www.hwg.org/
"Every man and every woman is a star."
------------------------------
Date: Fri, 07 Aug 1998 16:09:03 GMT
From: ptimmins@netserv.unmc.edu (Patrick Timmins)
Subject: Re: X-file (?=...), case postponed.
Message-Id: <6qf8qv$64c$1@nnrp1.dejanews.com>
NOTE: This was cross-posted to comp.lang.perl.moderated as well.
Don't know if it will get through, though.
In article <6qd3vc$5n2$1@mathserv.mps.ohio-state.edu>,
ilya@math.ohio-state.edu (Ilya Zakharevich) wrote:
[snip]
> You are mixing two things: RE engine, and Perl. Until *very*
> recently, Perl did not know anyting about RE engine, and RE engine
> knew nothing about Perl.
>
> Perl was providing RE engine a string and a pattern, and RE engine was
> returning Perl the results of the match, none of them knowing how the
> other is using the provided info.
>
> So: It is *split* who calls RE engine in a loop, making the frog
> restart at the place it finished the last time.
>
> [ Do not ask why with /(?=.*)/ the frog restarts at the same place as
> the previous time, but returns a different result - it is a smart
> frog. ]
>
> Ilya
>
I'm still not getting this.
Again, regarding Abigail's sig: [note that I botched this in my previous
post by leaving out the (?= ..) construct]:
@arr = split /(?=(.*))/s , "Just another Perl Hacker\n";
for (@arr) { print "elem:$_"; }
OK, so reading through the perldoc -f split:
split /PATTERN/,EXPR,LIMIT
1. If the PATTERN contains parentheses, additional array elements are
created from each matching substring in the delimiter.
2. If LIMIT is unspecified, trailing null fields are stripped
As a test, [note that I have no (?=..) here]:
@arr = split /(.*)/s , "Just another Perl Hacker\n";
for (@arr) { print "elem:$_"; }
So the .* matches the whole "Just another Perl Hacker\n" line
(including the \n, thanks to the /s modifier).
Splitting on that would give you 3 elements, with the first element
being "", the second element being "Just another Perl Hacker\n" (thanks
to rule 1 above), and the third element being "". But this third null
element gets stripped off, (thanks to rule 2 above), so we are left with
a two element array: @arr == ( "", "Just another Perl Hacker\n" ). I
understand this.
Now adding in the (?= .. ) is where I'm losing it. According to perldoc
perlre:
(?=regexp)
A zero-width positive lookahead assertion. For example, /\w+(?=\t)/
matches a word followed by a tab, without including the tab in $&.
@arr = split /(?=(.*))/s , "Just another Perl Hacker\n";
for (@arr) { print "elem:$_"; }
So $& is always going to be empty, no? Does split care about this?
Now I would expect this to behave the same as above in the beginning.
The .* would match the whole line, the first element would be null,
the second element the whole line, and the third element null (which
is stripped off, if it is the last element). But noooooooooo! The first
element is 'J', the second element is 'ust another Perl Hacker\n", the
third element is 'u', the fourth element is 'st another Perl Hacker\n",
etc.
Honest to goodness, I have expended much effort on this. Could someone
please tell me or hint at what I am missing? Otherwise my weekend will be
sucked into this God-forsaken vacuum.
Pleadingly yours,
Patrick Timmins
U. Nebraska Medical Center
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: Fri, 07 Aug 1998 12:27:47 -0400
From: John Porter <jdporter@min.net>
Subject: Re: X-File was reopened, and now cancer man smokes Crack!
Message-Id: <35CB2B03.7EF5@min.net>
F.Quednau wrote:
>[...]
Frank, what's all this "smoking crack"?
You've got me worried.
--
John Porter
------------------------------
Date: 7 Aug 1998 17:10:36 GMT
From: dustin@sonic.net (Dustin Mollo)
Subject: Re: Year 2000
Message-Id: <6qfcec$o5a$1@ultra.sonic.net>
F.Quednau (quednauf@nortel.co.uk) wrote:
: joe wrote:
: >
: > I was wondering about Perl and the Year 2000.
:
: I think we all do. I still don't know to which party to go on Newyear's
: eve 1999. Maybe I'll go to the desert and watch the innocence of a Camel
: walking on as if nothing had happened. Certainly would put things into
: perspective...
You should check out http://language.perl.com/news/y2k.html
That's pretty much as official as we get. OTOH, you could have spent a few
minutes searching this newsgroup on something like Deja News, as this issue
has been covered rather extensively in the past.
-Dustin
------------------------------
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 3391
**************************************