[17237] in Perl-Users-Digest
Perl-Users Digest, Issue: 4659 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Oct 19 00:05:34 2000
Date: Wed, 18 Oct 2000 21:05:09 -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: <971928308-v9-i4659@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Wed, 18 Oct 2000 Volume: 9 Number: 4659
Today's topics:
Re: Beyond useless (Tony L. Svanstrom)
Re: Case Statement? <jeff@vpservices.com>
Re: Counter doesn't work <tzz@heechee.beld.net>
Creating perl modules <troyr@vicnet.net.au>
Re: Creating perl modules <jdb@wcoil.com>
Re: Creating perl modules <elephant@squirrelgroup.com>
Re: manipulating data files <godzilla@stomp.stomp.tokyo>
Re: manipulating data files <harrisr@bignet.net>
Re: overloading of delete() not working (Ilya Zakharevich)
Re: Perl + Sessions <elephant@squirrelgroup.com>
Perl compile on Solaris 7 failure <foo@foo.com>
Re: Search, pad, replace (Duke Normandin)
Re: Search, pad, replace (Martien Verbruggen)
Re: Search, pad, replace (Duke Normandin)
Re: Test Your Perl Skills <sragan@bestweb.net>
Re: value exchange of two vars <bernie@fantasyfarm.com>
Re: value exchange of two vars <jeffp@crusoe.net>
Re: whence $0 (Peter McMorran)
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 19 Oct 2000 02:18:27 GMT
From: tony@svanstrom.com (Tony L. Svanstrom)
Subject: Re: Beyond useless
Message-Id: <1eiqem7.10gbpc019kde5aN%tony@svanstrom.com>
Mark Badolato <mbadolato@cybernox.com> wrote:
> Reviewing some code on Hotscripts for a script that has good reviews,
> and seems popular, I find this jem in the source code. I think this
> may take the cake in terms of all time useless...
>
> sub wknd {
> my $died = shift;
> my $used = shift;
> if ($died) {
> return;
> }
> else {
> return;
> }
> return;
> }
>
>
> Just thought I would share a laugh.
Can you get the guy to publicly comment on that? :)
/Tony
--
/\___/\ Who would you like to read your messages today? /\___/\
\_@ @_/ Protect your privacy: <http://www.pgpi.com/> \_@ @_/
--oOO-(_)-OOo---------------------------------------------oOO-(_)-OOo--
on the verge of frenzy - i think my mask of sanity is about to slip
---ôôô---ôôô-----------------------------------------------ôôô---ôôô---
\O/ \O/ ©99-00 <http://www.svanstrom.com/?ref=news> \O/ \O/
------------------------------
Date: Wed, 18 Oct 2000 19:14:36 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: Case Statement?
Message-Id: <39EE590C.C2B0EAF0@vpservices.com>
Larry Rosler wrote:
>
> In article <39EE1421.D35B2C2D@vpservices.com> on Wed, 18 Oct 2000
> 14:20:33 -0700, Jeff Zucker <jeff@vpservices.com> says...
> > JoeCoolCols wrote:
>
> ...
>
> > > If pick = 1
> > > Write question1 to form
> > > else if pick = 2
> > > Write question2 to form
> > > ...
> > > else write question132 to form
> >
> > That doesn't require a case statement, it requires a hash:
> >
> > my %question = (
> > 1 => 'What color is an orange?',
> > 2 => 'Where do they make swiss cheese?',
> > # ...
> > 132 => 'Is this the last question?',
> > );
>
> I would suggest an array instead, with a dummy entry for 0, or
> subtracting one from the index
An array would certainly do for this example. I suggested a hash because
it is more generally a good substitute for the kind of "case" statement
the OP was trying. Wouldn't want them to use an array this time and
then go back to trying a series of 132 if-elses when the key turned out
to be something other than a number.
> (but NOT "local $[ = 1;" :-).
Agreed :-).
--
Jeff
------------------------------
Date: 18 Oct 2000 22:37:04 -0400
From: Ted Zlatanov <tzz@heechee.beld.net>
Subject: Re: Counter doesn't work
Message-Id: <m3lmvl4kvj.fsf@heechee.beld.net>
Anders Lund <anders@wall.alweb.dk> writes:
> NEVER EVER use open() without die()
> if you don't test your open, and btw also close calls, you may end up in
> bad trouble.
I have to strongly disagree. Never use open() without checking the
return stats, sure. But die() is overkill in a lot of cases, and
indiscriminate use of die() instead of handling errors properly can
create fragile code that works only when the stars are aligned right.
The proper approach would be something like this:
if (open FILE ...)
{
# do the file processing
close FILE;
}
else
{
# handle the error appropriately - die, warn, whatever
}
--
Teodor Zlatanov <tzz@iglou.com>
"Brevis oratio penetrat colos, longa potatio evacuat ciphos." -Rabelais
------------------------------
Date: Thu, 19 Oct 2000 13:15:47 +1100
From: "Troy Rasiah" <troyr@vicnet.net.au>
Subject: Creating perl modules
Message-Id: <0QsH5.851$SF5.17787@ozemail.com.au>
Hi there,
I was wondering if anyone could give me a pointer in the right
direction or a sample procedure as on to how to make my own modules. I have
read perldoc -q "how to create modules" and have tried a sample script but
am missing something or other.
Any help will be appreciated
Thanks in Advance
Troy
------------------------------
Date: 19 Oct 2000 03:44:18 GMT
From: "Josiah" <jdb@wcoil.com>
Subject: Re: Creating perl modules
Message-Id: <8slqmi$1d0$0@206.230.71.26>
Troy Rasiah <troyr@vicnet.net.au> wrote in message
news:0QsH5.851$SF5.17787@ozemail.com.au...
> I was wondering if anyone could give me a pointer in the right
> direction or a sample procedure as on to how to make my own modules. I
have
> read perldoc -q "how to create modules" and have tried a sample script but
> am missing something or other.
Try this from a command line:
h2xs -X Mytest
It will then create a sub directory with all the files in it to make you own
module called Mytest, the directory will be called Mytest as well. It will
come complete with a Makefile.PL and a Mytest.pm that you can modify to
suite your needs. To test your new module, cd to the directory and do the
perl Makefile.PL, et al, routine. Then it will have your new module
installed. Cheers!
hth,
--
$from = <$josiah>;
------------------------------
Date: Thu, 19 Oct 2000 14:49:05 +1000
From: jason <elephant@squirrelgroup.com>
Subject: Re: Creating perl modules
Message-Id: <MPG.14592847751d608f98982c@localhost>
Troy Rasiah wrote ..
> I was wondering if anyone could give me a pointer in the right
>direction or a sample procedure as on to how to make my own modules. I have
>read perldoc -q "how to create modules" and have tried a sample script but
>am missing something or other.
perldoc perlmod
--
jason -- elephant@squirrelgroup.com --
------------------------------
Date: Wed, 18 Oct 2000 18:19:13 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: manipulating data files
Message-Id: <39EE4C11.DCACF866@stomp.stomp.tokyo>
triggerfish2001@hotmail.com wrote:
(k-rad kewl snippage)
> Hi,
You got to be kidding. "Hi" from someone
posting via a fake news server, via a fake
front for pathlink.com and via a fake email
address? Sure!
> I have just basic knowledge of perl.
O.J. Simpson is innocent.
> source file needs to be converted to target file.
> For eg:-
Oh my. This 'eg' is sointly becoming cliché!!
So many posters using fake servers and fake
email addresses are uttering this cliché
so very often! K RåÐ KeW£ ÐÛÐÊ¡¡
> source file will be as follows:
> John Smith 745-678-089011-10-1955
> Robert IhaveAlongName345-567-453219-04-1967
> Now this needs to be changed to
Right now or later?
> John Smith|745-678-0890|11-10-1955|
> Robert IhaveAlongName|345-567-4532|19-04-1967|
Use of a hot meta-character for a delimiter is
rather illogical. I will use a docile non-hostile
character instead! Too cool!
Ummm... do you want multiple spaces removed or not?
There is contradiction in your parameters and example.
*shrugs*
I am most certain a person with a basic knowledge
of Perl can figure out how to remove multiple spaces.
Godzilla!
--
TEST SCRIPT:
------------
#!/usr/local/bin/perl
print "Content-type: text/plain\n\n";
$input = "John Smith 745-678-089011-10-1955
Robert IhaveAlongName345-567-453219-04-1967";
@Array = split (/\n/, $input);
foreach $line (@Array)
{
$birth = substr ($line, -10, 10, "¦${\substr ($line, -10, 10)}");
$ssn = substr ($line, -23, 12, "¦${\substr ($line, -23, 12)}");
print "$line\n";
}
exit;
PRINTED RESULTS:
----------------
John Smith ¦745-678-0890¦11-10-1955
Robert IhaveAlongName¦345-567-4532¦19-04-1967
------------------------------
Date: Wed, 18 Oct 2000 22:03:37 -0400
From: "Randy Harris" <harrisr@bignet.net>
Subject: Re: manipulating data files
Message-Id: <suslimkvc4j1a@corp.supernews.com>
Not one of your better efforts G...
Godzilla! <godzilla@stomp.stomp.tokyo> wrote in message
news:39EE4C11.DCACF866@stomp.stomp.tokyo...
> triggerfish2001@hotmail.com wrote:
>
> (k-rad kewl snippage)
>
> > Hi,
>
> You got to be kidding. "Hi" from someone
> posting via a fake news server, via a fake
> front for pathlink.com and via a fake email
> address? Sure!
>
>
> > I have just basic knowledge of perl.
>
> O.J. Simpson is innocent.
>
You never know.
>
> > source file needs to be converted to target file.
>
> > For eg:-
>
> Oh my. This 'eg' is sointly becoming cliché!!
> So many posters using fake servers and fake
> email addresses are uttering this cliché
> so very often! K RåÐ KeW£ ÐÛÐÊ¡¡
>
>
> > source file will be as follows:
>
> > John Smith 745-678-089011-10-1955
> > Robert IhaveAlongName345-567-453219-04-1967
>
> > Now this needs to be changed to
>
> Right now or later?
>
>
> > John Smith|745-678-0890|11-10-1955|
> > Robert IhaveAlongName|345-567-4532|19-04-1967|
>
>
> Use of a hot meta-character for a delimiter is
> rather illogical. I will use a docile non-hostile
> character instead! Too cool!
>
> Ummm... do you want multiple spaces removed or not?
> There is contradiction in your parameters and example.
>
Example clearly shows spaces removed.
> *shrugs*
>
> I am most certain a person with a basic knowledge
> of Perl can figure out how to remove multiple spaces.
>
And come up with a better program than what follows.
>
> Godzilla!
> --
>
> TEST SCRIPT:
> ------------
>
> #!/usr/local/bin/perl
>
-w
> print "Content-type: text/plain\n\n";
>
> $input = "John Smith 745-678-089011-10-1955
> Robert IhaveAlongName345-567-453219-04-1967";
>
> @Array = split (/\n/, $input);
The OP said the data was coming from a file, but didn't say how large
the file was. The data should be processed a line at a time.
>
> foreach $line (@Array)
> {
> $birth = substr ($line, -10, 10, "¦${\substr ($line, -10, 10)}");
> $ssn = substr ($line, -23, 12, "¦${\substr ($line, -23, 12)}");
> print "$line\n";
> }
Why assign the variables if you are not going to use them?
My hunch is that substr would probably be more efficient, given the
fixed format of the input data, but it sure isn't as pretty as the
split/join method used in the earlier post.
>
> exit;
>
> PRINTED RESULTS:
> ----------------
>
> John Smith ¦745-678-0890¦11-10-1955
> Robert IhaveAlongName¦345-567-4532¦19-04-1967
------------------------------
Date: 19 Oct 2000 02:31:48 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: overloading of delete() not working
Message-Id: <8slmek$hs$1@charm.magnus.acs.ohio-state.edu>
[A complimentary Cc of this posting was sent to Josiah
<jdb@wcoil.com>],
who wrote in article <8sldfr$sal$0@206.230.71.38>:
> Overriding may be done only by importing the name from a
> module--ordinary predeclaration isn't good enough.
So it is overriding, not overloading...
> Alonng with the rest of the context that that is found in implies that this
> example above should work.
No it does not. (Even if you forget what kind of crap are Perl's docs...)
Ilya
P.S. Overriding only works for overridable keywords... Only those
keywords whose syntax can be expressed by a Perl function are
overridable (with a couple of bugs crept in both ways).
`delete' - obviously - cannot be.
------------------------------
Date: Thu, 19 Oct 2000 12:24:10 +1000
From: jason <elephant@squirrelgroup.com>
Subject: Re: Perl + Sessions
Message-Id: <MPG.14590659ec5065ba98982b@localhost>
Clay Irving wrote ..
>On Wed, 18 Oct 2000 11:33:13 GMT, mack_2@my-deja.com <mack_2@my-deja.com> wrote
>
>>i've tried to find some docs about session with perl, but i didn't find
>>any information.
>
>What kind of "sessions?"
>
>>so, does somebody know, whether perl support sessions, like php and asp
>>this do
>
>Ah... You must be referring to CGI. In that case:
>
> perldoc CGI
and don't forget - if you're using Apache
http://search.cpan.org/
and search for session (you'll get results if you search for that one in
the module name itself)
--
jason -- elephant@squirrelgroup.com --
------------------------------
Date: Wed, 18 Oct 2000 23:03:48 -0400
From: "news" <foo@foo.com>
Subject: Perl compile on Solaris 7 failure
Message-Id: <UttH5.31$O93.3725@eagle.america.net>
Tried to run perl -v (Perl 5.6) on Solaris 7 and get this error
Error fatal: libgdbm.so.2: open failed: No such file or directory
Killed
The file is a link to libgdbm.so.2.0.0 and it exists and is
readable/executable
So I tried rebuilding Perl - using 5.3 this time on Solaris 7 using gcc
get errors during the make depend. The file exists so
I went on with the make depend, then during the final make
I get the next error. I have the complete script of the process
if someone can help.
ld.so.1: ./try: fatal: libgdbm.so.2: open failed: No such file or directory
Killed
The program compiled OK, but exited with status 137.
(The supplied flags or libraries might be incorrect.)
# make
`sh cflags libperl.a miniperlmain.o` miniperlmain.c
CCCMD = gcc -B/usr/ccs/bin/ -DPERL_CORE -c -I/usr/local/include -O
`sh cflags libperl.a perl.o` perl.c
CCCMD = gcc -B/usr/ccs/bin/ -DPERL_CORE -c -I/usr/local/include -O
`sh cflags libperl.a malloc.o` malloc.c
CCCMD = gcc -B/usr/ccs/bin/ -DPERL_CORE -c -I/usr/local/include -O
malloc.c:267: parse error
malloc.c:320: parse error
gcc: file path prefix `/usr/ccs/bin/' never used
make: *** [malloc.o] Error 1
Any ideas anyone?
Regards
ric@unids.com
------------------------------
Date: Thu, 19 Oct 2000 01:15:21 GMT
From: 01031149@3web.net (Duke Normandin)
Subject: Re: Search, pad, replace
Message-Id: <rTrH5.451$mU.14720@jekyl.ab.tac.net>
In article <Pine.GSO.4.21.0010181144051.25707-100000@crusoe.crusoe.net>,
japhy@pobox.com wrote:
>[posted & mailed]
>
>>Thanks. You're an asshole.
>
>Um, he gave you a solution that fit what he interpreted your specs were,
>and told he ordinarily wouldn't have done this, and spent HIS time working
>on something for YOU, and HE'S an asshole? You sound pretty ungrateful to
>me.
>
As a Perl newbie that's been lurking this newsgroup for about 1 month now,
I must admit that I understand the hostile reaction demonstrated above.
If the purists "guru"s in this forum want to fraternize with each other,
and simply discuss the more obscure and fine points of Perl, then so-be-it
and more power to them. However, one of 2 things should then happen: 1)
this forum should be renamed to reflect the fact that it's for "guru"s
only; or 2) they should *all* move to a seperate venue and stroke
themselves appropriately.
The preponderance of posters to this list will either be novices or
intermediates who have no clue but are willing/have to take a stab at it.
No one needs the evangelizing, character-smearing, pimple-faced bullshine
that is so often predominant in this forum. If any of you don't want to
submit an answer to a posted query -- DON'T! However, it's none of you
guys' place to begrudge *anybody* for posting. If this newsgroup is only
about replying with RTFM or perlman/perldoc/perlre, then say so and have an
automated response to every new post stating as much.
Personal opinions concerning someone's motives, style, lack of knowledge,
or whatever, have no place in this forum, IMHO. You all should keep your
shit to yourself!! I dare say, that 98% of you mouthy bastards (not you
Jeff) (and you know who you are), would not have the gonads to say what you
do, to the person's face. I KNOW that you would not do it to me if we were
face to face.
We should ALL backup and re-evaluate the purpose of this newsgroup. It
seems to me that it's to help folks with problems in writing Perl scripts.
If you can/want to do so - politely - do so. If you don't -- SHUT THE FUCK
UP!
Now --- if ANYBODY wants my address, to meet face to face - email me!!
We'll get together -- distances are NO problem for me.
I will end by stating that IMHO, Ren Maddox (among others) epitomizes the
courtesy, competence and positive attitude that should prevail in this
newsgroup. We would all do well to model ourselves after him et al. This
other crap does Perl absolutely no good -- as does the fucking language
that I've used in this post. ;)
-duke
------------------------------
Date: Thu, 19 Oct 2000 12:50:18 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Search, pad, replace
Message-Id: <slrn8uskqq.fji.mgjv@martien.heliotrope.home>
On Thu, 19 Oct 2000 01:15:21 GMT,
Duke Normandin <01031149@3web.net> wrote:
Read what you wrote here:
> No one needs the evangelizing, character-smearing, pimple-faced bullshine
> that is so often predominant in this forum. If any of you don't want to
> submit an answer to a posted query -- DON'T! However, it's none of you
> guys' place to begrudge *anybody* for posting. If this newsgroup is only
> about replying with RTFM or perlman/perldoc/perlre, then say so and have an
> automated response to every new post stating as much.
And read this:
> Personal opinions concerning someone's motives, style, lack of knowledge,
> or whatever, have no place in this forum, IMHO. You all should keep your
And now, read this bit:
> shit to yourself!! I dare say, that 98% of you mouthy bastards (not you
> Jeff) (and you know who you are), would not have the gonads to say what you
> do, to the person's face. I KNOW that you would not do it to me if we were
> face to face.
Do you see any dissonance there? Especially the "personal opinions
concerning someone's motives" versus the sugestion of cowardliness is
quite interesting.
[snip]
> Now --- if ANYBODY wants my address, to meet face to face - email me!!
> We'll get together -- distances are NO problem for me.
Oh, puh-leeze.
> I will end by stating that IMHO, Ren Maddox (among others) epitomizes the
> courtesy, competence and positive attitude that should prevail in this
> newsgroup. We would all do well to model ourselves after him et al. This
> other crap does Perl absolutely no good -- as does the fucking language
> that I've used in this post. ;)
I am normally pretty polite. I even tend to be quite helpful. Just use
deja to check up on my posting history. What I can't stand is beggers
and the sort of gimme attitude that has been creeping into the general
culture that is infesting the net. And when I see that attitude, I
respond to it. If I accept projects with a deadline, I will make sure
that I can at least solve the problems in the project myself. If I
can't, I don't accept the project, or I pay someone else for that
particular bit of work. I do NOT beg someone else to do my work for me
for free. People who believe that that is what Usenet is for are wrong,
and are, quite frankly, selfish and rude.
Anyone who has been around long enough on Usenet to remember how it used
to be before this Microsoft OS's had a TCP/IP stack and before the
advent of the Web got more and more people connected, or even before it
used TCP/IP at all, will agree with me. Anyone who has at least a morsel
of respect for the value of other people's time will agree with me as
well. I don't really care how many people do agree with me. I know that
most people I respect feel the same way, or close to it. And that's
enough for me. Anyone who keeps defending this sort of shitty selfish
attitude can go and sit in my killfile. At least Usenet will SEEM like a
nice place still.
Thanks for identifying yourself.
Martien
--
Martien Verbruggen |
Interactive Media Division | We are born naked, wet and hungry.
Commercial Dynamics Pty. Ltd. | Then things get worse.
NSW, Australia |
------------------------------
Date: Thu, 19 Oct 2000 02:42:13 GMT
From: 01031149@3web.net (Duke Normandin)
Subject: Re: Search, pad, replace
Message-Id: <T8tH5.453$mU.15186@jekyl.ab.tac.net>
In article <slrn8uskqq.fji.mgjv@martien.heliotrope.home>,
mgjv@tradingpost.com.au wrote:
>On Thu, 19 Oct 2000 01:15:21 GMT,
> Duke Normandin <01031149@3web.net> wrote:
>
>Read what you wrote here:
>
>> No one needs the evangelizing, character-smearing, pimple-faced bullshine
>> that is so often predominant in this forum. If any of you don't want to
>> submit an answer to a posted query -- DON'T! However, it's none of you
>> guys' place to begrudge *anybody* for posting. If this newsgroup is only
>> about replying with RTFM or perlman/perldoc/perlre, then say so and have an
>> automated response to every new post stating as much.
>
>And read this:
>
>> Personal opinions concerning someone's motives, style, lack of knowledge,
>> or whatever, have no place in this forum, IMHO. You all should keep your
>
>And now, read this bit:
>
>> shit to yourself!! I dare say, that 98% of you mouthy bastards (not you
>> Jeff) (and you know who you are), would not have the gonads to say what you
>> do, to the person's face. I KNOW that you would not do it to me if we were
>> face to face.
>
>Do you see any dissonance there? Especially the "personal opinions
>concerning someone's motives" versus the sugestion of cowardliness is
>quite interesting.
Your sometimes pompous arragance and superior attitude is not an opinion,
it's a fact!! Although I admire you for your knowledge and apparant
competence, your attitudes leaves a lot to be desired at times. You seem
not to like/appreciate someone else telling it like it is! Why? The truth
bites doesn't it!
Look.... you and others have a lot to offer! Stick to the issues -- help
the folks if you will and be done with it.
>Oh, puh-leeze.
I'm giving you the opportunity to mealy-mouth me face-to-face, bud! The
ball is in your court. You may (and probably do) have legitimate concerns
and frustrations. Your ONLY remedy, is to NOT reply to those posts which
irk you. Simple isn't it! Hell, we may even go out and have a beer
afterwards. The ranching community I live in has a nice bar with so-so
entertainment. Lot's of drunken cowboys -- but that comes with the
territory. Doesn't bother me a damn bit! ;)
>I am normally pretty polite. I even tend to be quite helpful. Just use
>deja to check up on my posting history. What I can't stand is beggers
>and the sort of gimme attitude that has been creeping into the general
>culture that is infesting the net. And when I see that attitude, I
>respond to it. If I accept projects with a deadline, I will make sure
>that I can at least solve the problems in the project myself. If I
>can't, I don't accept the project, or I pay someone else for that
>particular bit of work. I do NOT beg someone else to do my work for me
>for free. People who believe that that is what Usenet is for are wrong,
>and are, quite frankly, selfish and rude.
Again... your frustrations are probably well-founded! Don't reply -- and if
you do, don't put anybody down. Stick with issue, and your stature will
increase exponentially.
>Anyone who has been around long enough on Usenet to remember how it used
>to be before this Microsoft OS's had a TCP/IP stack and before the
>advent of the Web got more and more people connected, or even before it
>used TCP/IP at all, will agree with me. Anyone who has at least a morsel
>of respect for the value of other people's time will agree with me as
>well. I don't really care how many people do agree with me. I know that
>most people I respect feel the same way, or close to it. And that's
>enough for me. Anyone who keeps defending this sort of shitty selfish
>attitude can go and sit in my killfile. At least Usenet will SEEM like a
>nice place still.
You do what you have to do bud.... but if you can't take the heat, get out
of the kitchen. Remember this.... "it's better to be pissed-off than pissed
on! ;) You be nice -- and folks will respond in a like manner. You'll
recall that YOU were the one that set the stage for my response. There was
absolutely NO need to say what you said outside the perl code issues.
NOTHING god and positive came of it -- did it? Other than you're getting a
tuning in that you deserve.
You semm frustrated, overworked or something! You're taking Perl/Unix etc
all too seriously. Go out-- have a beer; get laid; go fishing -- relax!!!
At the end of the day -- life goes on -- Perl is still here -- more newbies
with dumb questions. It takes a good man to take a dumb newbie at anything
and clone him into your own image and likeness. Would you not agree?
>Thanks for identifying yourself.
You're more than welcome. You identified yourself to me as an apparantly
very competent Perl wizard. I read every word you write. Adjust the
attitude -- that's all. Enough of this -- back to Perl!
-duke
------------------------------
Date: Thu, 19 Oct 2000 02:52:17 GMT
From: "Steve Ragan" <sragan@bestweb.net>
Subject: Re: Test Your Perl Skills
Message-Id: <BltH5.7675$mC.532801@monger.newsread.com>
> > Which character sequence will match a word boundary?
> >
> > a. /b
> > b. /c
> > c. /t
> > d. /w
> > e. none
> >
> > Again, the answer is (a).
>
> are you sure that you typed that correctly? none of those
> are regex assertions. perhaps you meant \b ?
>
I saw this site and it's pretty cheesy. When I saw the question above I left
for good.
That's no typo on Rich's part - that's the way it appeared in the so-called
certification.
I think it speaks volumes about the certification process.
Steve
Lets Go Mets!
------------------------------
Date: Wed, 18 Oct 2000 22:37:23 -0400
From: Bernie Cosell <bernie@fantasyfarm.com>
Subject: Re: value exchange of two vars
Message-Id: <fqmsusoaiq4jmtije3s22hign7ar3fg6ld@news.supernews.net>
Jeff Pinyan <jeffp@crusoe.net> wrote:
} [posted & mailed]
}
} On Oct 17, Paul said:
}
} >i have heart that there is the possibility to exchange the values of
} >variables in one step.
} >please can anybody tell me how this works?!
}
} ($a,$b) = ($b,$a);
}
} Perl evaluates the values of the variables on the RHS (right-hand side) of
} the expression, and then assigns them IN PARALLEL to the variables on the
} LHS.
I don't mean to be picky here, but is this really a correct description?
'in parallel' is nice to say but not my understanding of it all [and
indeed, it is not really 'parallel' in the sense of languages and
processing environments that can _really_ do things in parallel].
My understanding of this construct [and I'm sure I'll be corrected if it is
mistaken] is:
First we remember that Perl preservers lvalue-ness whenever it can, and so
the list on the LHS lvalue-evaluates to a list of pointers-to-the-vars.
The RHS is evaluated in list context, and so Perl builds a _copy_ of the
variables A and B into a temp list, and then does a list-assignment of that
list to the LHS, which since the LHS has been lvalue preserved and so the
assignment goes BACK to the originals and $a gets the first value from the
RHS list and $b gets the second value from the RHS list. Nothing happening
in 'parallel', just a temporary list built on the stack [or somewhere] and
then that list assigned to the LHS just like any other list-context
assignment...
[If my understanding of this is correct [which it may well not be, I
realize], then I think talking about "parallel" just unnecessarily
obfuscates what's going on [*especially* to folk familiar with _real_
parallel processing environments, where things happening "in parallel"
can/does mean something a LOT more complicated than this]
The newcomer to this idiom might get the impression that there is some sort
of magic afoot, rather than just something they really need to learn: that
LHS evaluations try very hard to preserve lvalue-ness [and once you
understand that, and you think a bit about the list-context assignment, it
is obvious that that'd swap the values,just as:
($a, $b, $c, $d) = ($d, $c, $a, $b)
does slightly more complicated permutation of the values "in parallel" [sic
:o)] using the same idea...
/Bernie\
--
Bernie Cosell Fantasy Farm Fibers
bernie@fantasyfarm.com Pearisburg, VA
--> Too many people, too few sheep <--
------------------------------
Date: Wed, 18 Oct 2000 23:19:21 -0400
From: Jeff Pinyan <jeffp@crusoe.net>
Subject: Re: value exchange of two vars
Message-Id: <Pine.GSO.4.21.0010182316270.25707-100000@crusoe.crusoe.net>
[posted & mailed]
On Oct 18, Bernie Cosell said:
>Jeff Pinyan <jeffp@crusoe.net> wrote:
>
>} ($a,$b) = ($b,$a);
>}
>} Perl evaluates the values of the variables on the RHS (right-hand side) of
>} the expression, and then assigns them IN PARALLEL to the variables on the
>} LHS.
>
>I don't mean to be picky here, but is this really a correct description?
>'in parallel' is nice to say but not my understanding of it all [and
>indeed, it is not really 'parallel' in the sense of languages and
>processing environments that can _really_ do things in parallel].
By "in parallel", I meant that it's NOT doing:
$a = $b;
$b = $a;
But rather setting $a and $b to the values of $b and $a AS THEY WERE. It
is more correct to explain this as a parallel action, than a series
action.
> ($a, $b, $c, $d) = ($d, $c, $a, $b)
>does slightly more complicated permutation of the values "in parallel" [sic
>:o)] using the same idea...
To my best understanding, Perl pushes the values of $d, $c, $a, and $b
onto the stack, and then reads them off one at a time, and stores them in
$a, $b, $c, and $d. "Stack" might not be the proper term, since I think
that implies a last-in, first-out (LIFO) approach. This is more of a
queue, I guess.
--
Jeff "japhy" Pinyan japhy@pobox.com http://www.pobox.com/~japhy/
PerlMonth - An Online Perl Magazine http://www.perlmonth.com/
The Perl Archive - Articles, Forums, etc. http://www.perlarchive.com/
CPAN - #1 Perl Resource (my id: PINYAN) http://search.cpan.org/
------------------------------
Date: Wed, 18 Oct 2000 21:00:55 -0400
From: mcmorran@visi.net (Peter McMorran)
Subject: Re: whence $0
Message-Id: <39ee496c$4$zpzbeena$mr2ice@news.visi.net>
In <8sf6mu$jbg@fidoii.CC.Lehigh.EDU>, on 10/16/00
at 11:27 AM, "Phil R Lawrence" <prlawrence@lehigh.edu> said:
>So $0 contains the name of the file containing the Perl script
>currently being executed, but where can I find the path to said
>file?
>The bigger picture:
>my boss wants the -? flag to print out a help file named
>README.file_name located in the same directory.
>Comments?
>Phil R Lawrence
Hello Phil,
A little clarification is in order here. On Unix-like systems, if
you have a script called fred.pl, and run it from the prompt as
% fred.pl
then $0 contains either the simple name of the file, if it was
run from the current directory, or the expanded path to the file
consisting of the name prefixed by the entry in $path that was
used to find it. The tricky case, and the one you describe, is
when $0 does not begin with /. Then, you need to prefix it with
$cwd/ to get a consistent path string for all executions. I'm not
sure how this works on those other widely-used operating systems.
Cheers,
Peter
--
-----------------------------------------------------------
mcmorran@visi.net (Peter McMorran)
-----------------------------------------------------------
------------------------------
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 4659
**************************************