[22667] in Perl-Users-Digest
Perl-Users Digest, Issue: 4888 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Apr 24 14:12:03 2003
Date: Thu, 24 Apr 2003 11:10:10 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Thu, 24 Apr 2003 Volume: 10 Number: 4888
Today's topics:
Re: Tough question for the guru's; Grep Once, Awk Twice (Agrapha)
Re: Tough question for the guru's; Grep Once, Awk Twice (Agrapha)
Re: Tough question for the guru's; Grep Once, Awk Twice (Helgi Briem)
Re: Tough question for the guru's; Grep Once, Awk Twice (Sara)
Re: Tough question for the guru's; Grep Once, Awk Twice (Agrapha)
Re: Tough question for the guru's; Grep Once, Awk Twice <ethan@draupnir.gso.saic.com>
Re: Tough question for the guru's; Grep Once, Awk Twice (Anno Siegel)
Undefining Aggregates <no-spam-TeanerTiner@hotmail.com>
Re: Undefining Aggregates <uri@stemsystems.com>
Re: Undefining Aggregates <no-spam-TeanerTiner@hotmail.com>
Re: Undefining Aggregates <wksmith@optonline.net>
Re: Undefining Aggregates <no-spam-TeanerTiner@hotmail.com>
Re: webhosts that support perl well? (dan baker)
What is 'bootstrap' ? (Lax)
Re: What is 'bootstrap' ? <galenmenzel@yahoo.com>
Re: What is 'bootstrap' ? <wksmith@optonline.net>
Where to upload/announce an emacs pod-mode? <schwigon@webit.de>
Re: Where to upload/announce an emacs pod-mode? (Randal L. Schwartz)
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 24 Apr 2003 06:48:02 -0700
From: brian@box201.com (Agrapha)
Subject: Re: Tough question for the guru's; Grep Once, Awk Twice (or more)
Message-Id: <11aabb15.0304240548.3cf3645@posting.google.com>
tadmc@augustmail.com (Tad McClellan) wrote in message news:<slrnbaepqv.22d.tadmc@magna.augustmail.com>...
>
> Who "you"?
>
> Please be polite and provide an attribution when you quote someone.
>
Yep I will do so in the future. Sorry about that I didn't realize I
was cutting out the sender info.
>
>
> If you are rude, you can expect rudeness in return.
>
> Many here see/saw you as rude from your very first couple of posts.
>
I probably asked the first question wrong. My shell script was all I
had as a pattern to try and explain what I needed to do. Perl was
recommended to me because of the inefficiency of my shell script.
My first post was dismissed as someone asking for somebody else to
code it into perl for free. I needed to learn Perl. This was the
perfect project for a beginner. A code a little out of reach but
attainable. Something like what I eventually got. I did't want someone
to write the code for me. Just give me enough to know where to begin
to learn.
> > Are you an important person?
>
> You seem to think that _you_ are such a person.
nope I'm not. We keep the internet working at night. In fact we are
easy to overlook. The only reason I acted defensive is i was already
in a corner. I didn't need burned on a first post.
Still there were a few people who were willing to help regardless and
I think I have a better idea what I am going to need to do now. If I
understand what I have been taught in the last 24 hours. I'll try to
post a working code later today. Thanks to everyone who put up with
this beginner.
------------------------------
Date: 24 Apr 2003 07:13:19 -0700
From: brian@box201.com (Agrapha)
Subject: Re: Tough question for the guru's; Grep Once, Awk Twice (or more)
Message-Id: <11aabb15.0304240613.3f353347@posting.google.com>
Uri Guttman <uri@stemsystems.com> wrote in message news:<x71xzsprsc.fsf@mail.sysarch.com>...
> >>>>> "A" == Agrapha <brian@box201.com> writes:
>
> wow! some real code!!
yup. I said I was learning
> use a better emailer as this is wrapping and making the code unpastable.
hmmm I see what you mean. Not very readable. I post from google so
that could be it. I don't have a emailer program. If you have a good
alternative emailer I'd be glad to try it. Especially since I want to
upload a working code today if I can.
> gack! this is perl, not c.
*smile well I didn't know about a $i = @RAWDATA;
I walked thru the file line by line in order to filter my results. I
may not need to do that
> you don't. you use a hash and count unique lines that way.
Yup thats what I'm not sure how to do. perldocs got something?
------------------------------
Date: Thu, 24 Apr 2003 14:23:19 GMT
From: helgi@decode.is (Helgi Briem)
Subject: Re: Tough question for the guru's; Grep Once, Awk Twice (or more)
Message-Id: <3ea7f329.1207773266@news.cis.dfn.de>
On 24 Apr 2003 07:13:19 -0700, brian@box201.com (Agrapha)
wrote:
>> you don't. you use a hash and count unique lines that way.
>
>Yup thats what I'm not sure how to do. perldocs got something?
perldoc -q duplicate
--
Regards, Helgi Briem
helgi DOT briem AT decode DOT is
------------------------------
Date: 24 Apr 2003 07:37:56 -0700
From: genericax@hotmail.com (Sara)
Subject: Re: Tough question for the guru's; Grep Once, Awk Twice (or more)
Message-Id: <776e0325.0304240637.c38a255@posting.google.com>
Uri Guttman <uri@stemsystems.com> wrote in message news:<x7n0igo7s1.fsf@mail.sysarch.com>...
.
.
... entertaining discourse removed for brevity
.
.
>
> as for your query here, read the perl FAQ which has answers for counting
> stuff
>
> oops, i gave you more help. my bad!
^
Uri, have you been coding too much lately? You don't need to "declare"
your adjectives!
Hahah,
Gx
>
> uri
------------------------------
Date: 24 Apr 2003 10:05:22 -0700
From: brian@box201.com (Agrapha)
Subject: Re: Tough question for the guru's; Grep Once, Awk Twice (or more)
Message-Id: <11aabb15.0304240905.6f42ace2@posting.google.com>
helgi@decode.is (Helgi Briem) wrote in message news:<3ea7f329.1207773266@news.cis.dfn.de>...
> On 24 Apr 2003 07:13:19 -0700, brian@box201.com (Agrapha)
> wrote:
>
> >> you don't. you use a hash and count unique lines that way.
> >
> >Yup thats what I'm not sure how to do. perldocs got something?
>
> perldoc -q duplicate
I must have an old build. When I issue the command above I get this
result:
> perldoc -q duplicate
No documentation for perl FAQ keyword `duplicate' found
>
my system is FreeBSD4.7 so I'm pretty sure it's just my build. Thats a
good question. How do I ask Perl what version it is?
------------------------------
Date: 24 Apr 2003 10:25:10 -0700
From: Ethan Brown <ethan@draupnir.gso.saic.com>
Subject: Re: Tough question for the guru's; Grep Once, Awk Twice (or more)
Message-Id: <vrllxzbyfd.fsf@draupnir.gso.saic.com>
>>>>> "Tad" == Tad McClellan <tadmc@augustmail.com> writes:
Hi Tad!
Tad> Ethan Brown <ethan@draupnir.gso.saic.com> wrote:
>> One of the cool (or confusing :-) things about Perl is you get
>> different results for different "contexts".
Tad> One of the cool or confusing things about natural language is you get
Tad> different results for different "contexts".
... which has often been the cause of the end of
relationships and the start of wars. I hope Perl has never been the
cause of a relationship ending (although I think my wife sometimes
gets annoyed at me for spending an inordinate amount of time on my
Perl projects :-).
>> For example, there is an
>> array context and a scalar context.
Tad> For example, there is a plural context and a singular context. :-)
I like your analog of natural language contexts and Perl contexts.
Contexts can be confusing in both contexts, if you get my context.
Are you aware of any other programming languages that use contexts?
It's one of the really novel Perlisms. I've programmed pretty
extensively in C, Fortran, Lisp, Scheme, and Java, but contexts was a
very cool new concept for me when I learned Perl.
Do you know where Larry came up with the idea?
>> print @RAWDATA[$#RAWDATA - 4 .. $#RAWDATA]
>>
>> but that prints things all together. Let's put spaces between the
>> elements when we print them out:
>>
>> print join(' ', @RAWDATA[$#RAWDATA - 4 .. $#RAWDATA])
Tad> You can add two characters to the 1st one to get spaces between them:
Tad> print "@RAWDATA[$#RAWDATA - 4 .. $#RAWDATA]"
Nice! I suppose I should have used ', ' so you wouldn't have had such an
easy target.
Take care,
--Ethan Brown
--Keyboards: "The Fabulous Pelicans" (www.pelicans.com)
--In a band? Use http://www.WheresTheGig.com for free.
------------------------------
Date: 24 Apr 2003 17:42:32 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Tough question for the guru's; Grep Once, Awk Twice (or more)
Message-Id: <b897m8$s9p$1@mamenchi.zrz.TU-Berlin.DE>
Ethan Brown <ethan@draupnir.gso.saic.com> wrote in comp.lang.perl.misc:
> >>>>> "Tad" == Tad McClellan <tadmc@augustmail.com> writes:
> >> print join(' ', @RAWDATA[$#RAWDATA - 4 .. $#RAWDATA])
>
> Tad> You can add two characters to the 1st one to get spaces between them:
> Tad> print "@RAWDATA[$#RAWDATA - 4 .. $#RAWDATA]"
>
> Nice! I suppose I should have used ', ' so you wouldn't have had such an
> easy target.
{
local $, = ', ';
print "@RAWDATA[$#RAWDATA - 4 .. $#RAWDATA]";
}
Of course, nobody writes it this way, join() is clearer and shorter.
Anno
------------------------------
Date: Thu, 24 Apr 2003 14:50:39 GMT
From: TeanerTiner <no-spam-TeanerTiner@hotmail.com>
Subject: Undefining Aggregates
Message-Id: <3RSpa.42259$M_2.32679@twister.nyroc.rr.com>
I have read all the threads concerning undefining aggregates, and I
understand the reasoning behind them. However, I *really* want to
undefine a hash so that 'defined(%hash)' is false. I found just this
exact thing in the Shiny Ball book, page 16. But it does not work in my
testing.
I am not trying to start a flame war, just create a consistent API for
some code I am writing.
Thanks,
Brant
------------------------------
Date: Thu, 24 Apr 2003 15:10:54 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: Undefining Aggregates
Message-Id: <x7y920lyma.fsf@mail.sysarch.com>
>>>>> "T" == TeanerTiner <no-spam-TeanerTiner@hotmail.com> writes:
T> I have read all the threads concerning undefining aggregates, and I
T> understand the reasoning behind them. However, I *really* want to
T> undefine a hash so that 'defined(%hash)' is false. I found just this
T> exact thing in the Shiny Ball book, page 16. But it does not work in
T> my testing.
why do you want to do that? you had better have an amazing and cogent
reason for it.
T> I am not trying to start a flame war, just create a consistent API for
T> some code I am writing.
you just did. there is no earthly reason to undef aggregates. you have
to be a perl black magic wizard to possibly ever want to do it. it will
lead to sorrow and pain for you and all others that will ever read your
code. doing that will not lead to a consistant api. it will lead you on
the road to coding hell. i don't have time but i will post again with
more reasons (which i have before and you probably found in google) as
to why this is evil incarnate.
and my primary guess is that you have a very poor design that would even
lead you to think this is a good idea. i have built countless consistant
(and complex) api's and never even thought about doing undef on an
aggregate. so this is a major red flag that you have some fundamental
design problems that this will not cure.
so try to explain what your real goals are (not the undef stuff) and we
can help you extricate yourself from this dead-end path you painted
yourself into (love them mixed metaphores!).
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
------------------------------
Date: Thu, 24 Apr 2003 16:07:54 GMT
From: TeanerTiner <no-spam-TeanerTiner@hotmail.com>
Subject: Re: Undefining Aggregates
Message-Id: <uZTpa.42398$M_2.17104@twister.nyroc.rr.com>
Uri Guttman wrote:
>>>>>>"T" == TeanerTiner <no-spam-TeanerTiner@hotmail.com> writes:
>
>
> T> I have read all the threads concerning undefining aggregates, and I
> T> understand the reasoning behind them. However, I *really* want to
> T> undefine a hash so that 'defined(%hash)' is false. I found just this
> T> exact thing in the Shiny Ball book, page 16. But it does not work in
> T> my testing.
>
> why do you want to do that? you had better have an amazing and cogent
> reason for it.
>
> T> I am not trying to start a flame war, just create a consistent API for
> T> some code I am writing.
>
When making a call and passing a reference to a parameter that recieves
a value, I want to undefine the parameter if there is an error. For example,
scalar example:
$iReturnValue = funcCall(\$param)
If the function funcCall fails, I return an error code in $iReturnValue
and set $param to 'undef'. This way the coder cannot use $param by accident.
This does not work in a consistent fashion for aggregates.
> you just did. there is no earthly reason to undef aggregates. you have
> to be a perl black magic wizard to possibly ever want to do it. it will
> lead to sorrow and pain for you and all others that will ever read your
> code. doing that will not lead to a consistant api. it will lead you on
> the road to coding hell. i don't have time but i will post again with
> more reasons (which i have before and you probably found in google) as
> to why this is evil incarnate.
>
> and my primary guess is that you have a very poor design that would even
> lead you to think this is a good idea.
It is too bad you think so much of yourself that you cannot answer a
question without being rude and inconsiderate. I truly doubt that your
methods are so superior that any others are worthless. Your attitude is
what gives Perl hackers a bad name for being conceited.
i have built countless consistant
> (and complex) api's and never even thought about doing undef on an
> aggregate. so this is a major red flag that you have some fundamental
> design problems that this will not cure.
>
> so try to explain what your real goals are (not the undef stuff) and we
> can help you extricate yourself from this dead-end path you painted
> yourself into (love them mixed metaphores!).
>
> uri
>
------------------------------
Date: Thu, 24 Apr 2003 16:22:09 GMT
From: "Bill Smith" <wksmith@optonline.net>
Subject: Re: Undefining Aggregates
Message-Id: <RaUpa.112518$MB4.39303136@news4.srv.hcvlny.cv.net>
"TeanerTiner" <no-spam-TeanerTiner@hotmail.com> wrote in message
news:3RSpa.42259$M_2.32679@twister.nyroc.rr.com...
> I have read all the threads concerning undefining aggregates, and I
> understand the reasoning behind them. However, I *really* want to
> undefine a hash so that 'defined(%hash)' is false. I found just this
> exact thing in the Shiny Ball book, page 16. But it does not work in
my
> testing.
--snip--
When I checked perldoc -f defined (for perl version 5.6.1), I found:
Use of "defined" on aggregates (hashes and arrays) is deprecated
It used to report whether memory for that aggregate has ever been
allocated. This behavior may disappear in future versions of Perl.
You should instead use a simple test for size:
This suggests that 'defined' does not mean exactly what you think, and
that it probably not a good idea to use it in this way.
Bill
if (@an_array) { print "has array elements\n" }
if (%a_hash) { print "has hash members\n" }
------------------------------
Date: Thu, 24 Apr 2003 16:37:37 GMT
From: TeanerTiner <no-spam-TeanerTiner@hotmail.com>
Subject: Re: Undefining Aggregates
Message-Id: <lpUpa.42508$M_2.37170@twister.nyroc.rr.com>
Bill Smith wrote:
> "TeanerTiner" <no-spam-TeanerTiner@hotmail.com> wrote in message
> news:3RSpa.42259$M_2.32679@twister.nyroc.rr.com...
>
>>I have read all the threads concerning undefining aggregates, and I
>>understand the reasoning behind them. However, I *really* want to
>>undefine a hash so that 'defined(%hash)' is false. I found just this
>>exact thing in the Shiny Ball book, page 16. But it does not work in
>
> my
>
>>testing.
>
> --snip--
>
> When I checked perldoc -f defined (for perl version 5.6.1), I found:
>
> Use of "defined" on aggregates (hashes and arrays) is deprecated
> It used to report whether memory for that aggregate has ever been
> allocated. This behavior may disappear in future versions of Perl.
> You should instead use a simple test for size:
>
>
> This suggests that 'defined' does not mean exactly what you think, and
> that it probably not a good idea to use it in this way.
>
> Bill
> if (@an_array) { print "has array elements\n" }
> if (%a_hash) { print "has hash members\n" }
Thanks for the reply Bill. However, I do not want to know if the
aggregate has members. I want it to not exist, to use the language from
perldoc - I want there to be no memory allocated for aggregate and be
able to determine that.
>
>
>
>
>
>
>
>
------------------------------
Date: 24 Apr 2003 07:58:35 -0700
From: botfood@yahoo.com (dan baker)
Subject: Re: webhosts that support perl well?
Message-Id: <13685ef8.0304240658.29046aa4@posting.google.com>
Greg <greg@hassan.com> wrote in message news:<3EA6E140.8000808@hassan.com>...
> >>I realize this is not a *pure* perl question..... but I'm looking for
> >>some feedback from perl programmers who may have found some reasonable
> >>web hosts that do a good job supporting sites with custom scripts.
>
> You might try fatcow.com or nwrks.net. I think you
> wont get any support for custom perl, unless you pay
> for it. You can certainly install any extra modules
> in your sub-dir as needed.
> --------------
yeah, most modules can be installed locally, but *some* like
ImageMagik are a bitch if you're not installing as root in the /usr
d
------------------------------
Date: 24 Apr 2003 07:20:47 -0700
From: lax_reddy@hotmail.com (Lax)
Subject: What is 'bootstrap' ?
Message-Id: <ecd05021.0304240620.a23c2f4@posting.google.com>
What is a "bootstrap" in Perl?
On page 535 of "Programming Perl", its used as "bootstrap Mytest
$VERSION;", but not enough info. is provided.
What does it do? Is it a built-in function of sorts?
Please enlighten.
Thanks,
Lax
------------------------------
Date: 24 Apr 2003 14:33:27 GMT
From: Galen Menzel <galenmenzel@yahoo.com>
Subject: Re: What is 'bootstrap' ?
Message-Id: <slrnbaftji.sh.galenmenzel@localhost.localdomain>
In article <ecd05021.0304240620.a23c2f4@posting.google.com>, Lax wrote:
> What is a "bootstrap" in Perl?
>
> On page 535 of "Programming Perl", its used as "bootstrap Mytest
> $VERSION;", but not enough info. is provided.
> What does it do? Is it a built-in function of sorts?
>
It's part of the DynaLoader. Check:
perldoc DynaLoader
galen
------------------------------
Date: Thu, 24 Apr 2003 16:03:41 GMT
From: "Bill Smith" <wksmith@optonline.net>
Subject: Re: What is 'bootstrap' ?
Message-Id: <xVTpa.112281$MB4.39253001@news4.srv.hcvlny.cv.net>
"Galen Menzel" <galenmenzel@yahoo.com> wrote in message
news:slrnbaftji.sh.galenmenzel@localhost.localdomain...
> In article <ecd05021.0304240620.a23c2f4@posting.google.com>, Lax
wrote:
> > What is a "bootstrap" in Perl?
> >
> > On page 535 of "Programming Perl", its used as "bootstrap Mytest
> > $VERSION;", but not enough info. is provided.
> > What does it do? Is it a built-in function of sorts?
> >
>
> It's part of the DynaLoader. Check:
>
> perldoc DynaLoader
Just an interesting note on the name "bootstrap." In the early days of
computing (before operating systems), directly executable programs were
kept on perforated tape. The code to load those programs into memory
was at the begining of the tape. That code was called the "bootstrap"
in analogy with the then familiar saying about "picking oneself up by
his own bootstrap." Of course, hardware had to read the bootstrap. In
one machine I used, the bootstrap consisted of several layers. The
hardware read just one instruction from the tape. Repeated execution of
that instruction loaded a seven instruction program which loaded the
program which actually loaded the application. Loading a program this
way was called "bootstraping" or "booting" for short. Modern usage of
these terms no longer makes much sense except from this historical
perspective.
Enjoy,
Bill
------------------------------
Date: 24 Apr 2003 17:08:48 +0200
From: Steffen Schwigon <schwigon@webit.de>
Subject: Where to upload/announce an emacs pod-mode?
Message-Id: <87u1colypr.fsf@teufelkommraus.webit.de>
Hi!
I have written an emacs mode for editing .pod files.
1. Is there a place/category on CPAN where such indirect perl stuff
can be uploaded? Anywhere else?
2. Where do I announce it? (I was rejected at c.l.p.announce)
(Greeti+Tha)nX
Steffen
--
Steffen Schwigon <schwigon@webit.de>
------------------------------
Date: Thu, 24 Apr 2003 15:43:47 GMT
From: merlyn@stonehenge.com (Randal L. Schwartz)
To: Steffen Schwigon <schwigon@webit.de>
Subject: Re: Where to upload/announce an emacs pod-mode?
Message-Id: <6ded6b8e6980630855899f74e5ab3533@TeraNews>
>>>>> "Steffen" == Steffen Schwigon <schwigon@webit.de> writes:
Steffen> Hi!
Steffen> I have written an emacs mode for editing .pod files.
Steffen> 1. Is there a place/category on CPAN where such indirect perl stuff
Steffen> can be uploaded? Anywhere else?
Your CPAN author directory, yes.
Steffen> 2. Where do I announce it? (I was rejected at c.l.p.announce)
It was rejected simply because it was not in the CPAN. Get a PAUSE
ID, put it in your author directory, and resubmit your CLPA post.
Sorry if I was too brief for you to understand that. :)
For example, ILYAZ has "CPerl-Mode" in his author directory. That's a
perfectly reasonable use for CPAN.
print "Just another Perl hacker," # and CLPA moderator
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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.
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 V10 Issue 4888
***************************************