[22665] in Perl-Users-Digest
Perl-Users Digest, Issue: 4886 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Apr 24 09:10:33 2003
Date: Thu, 24 Apr 2003 06:10:11 -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: 4886
Today's topics:
Re: Tough question for the guru's; Grep Once, Awk Twice (Anno Siegel)
Re: Tough question for the guru's; Grep Once, Awk Twice <bernard.el-hagin@DODGE_THISlido-tech.net>
Re: Tough question for the guru's; Grep Once, Awk Twice (Agrapha)
Re: Tough question for the guru's; Grep Once, Awk Twice <tassilo.parseval@rwth-aachen.de>
Re: Tough question for the guru's; Grep Once, Awk Twice <tassilo.parseval@rwth-aachen.de>
Re: Tough question for the guru's; Grep Once, Awk Twice (Agrapha)
Re: Tough question for the guru's; Grep Once, Awk Twice (Tad McClellan)
Re: Tough question for the guru's; Grep Once, Awk Twice <bernard.el-hagin@DODGE_THISlido-tech.net>
Re: Tough question for the guru's; Grep Once, Awk Twice (Helgi Briem)
Re: Tough question for the guru's; Grep Once, Awk Twice (Agrapha)
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 24 Apr 2003 10:16:04 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: <b88dh4$a2k$1@mamenchi.zrz.TU-Berlin.DE>
Agrapha <brian@box201.com> wrote in comp.lang.perl.misc:
> >
> > do you realize who you just slammed? look him up on google and see if he
> > ever has helped the perl community.
>
> Honestly I am hear to learn and not to banter.
That needed saying. It certainly isn't apparent from your behavior.
Anno
------------------------------
Date: Thu, 24 Apr 2003 10:18:27 +0000 (UTC)
From: "Bernard El-Hagin" <bernard.el-hagin@DODGE_THISlido-tech.net>
Subject: Re: Tough question for the guru's; Grep Once, Awk Twice (or more)
Message-Id: <Xns93677D10F3520elhber1lidotechnet@62.89.127.66>
Agrapha wrote:
[...]
>> > if I can only get complaints about posting then I shall look
>> > elsewhere.
>>
>>
>> Thank you.
>
> Oh no, I a perma-member now. Soley because of your post.
That's pretty sad, you know.
> btw thank you for driving me to it. I would have probably blown it off
> as a place for fantasy armchair programmers but not after your post.
Why would you think Tad cares? Can you say "killfile"?
--
Cheers,
Bernard
--
echo 42|perl -pe '$#="Just another Perl hacker,"'
------------------------------
Date: 24 Apr 2003 04:38:31 -0700
From: brian@box201.com (Agrapha)
Subject: Re: Tough question for the guru's; Grep Once, Awk Twice (or more)
Message-Id: <11aabb15.0304240338.40d43e9a@posting.google.com>
tiltonj@erols.com (Jay Tilton) wrote in message news:<3ea76427.44366338@news.erols.com>...
>
> Yipe.
>
I feel like a yipe recently but it's getting clearer :)
>
> Your @F (an array) is not the same thing as Tassilo's F (a
> filehandle). As well, Perl's grep() is not what you seem to think it
> is. The condition ",0 " is not automatically interpreted as a regex.
> It's just a string that will always evaluate true.
>
> You might be shooting for something like,
>
> while(<F>) {
> push @SELECT, $_ if /,0 /;
> }
>
whoa
include the real expression /,0 / and not the literal string...That
works.
The "If " on the end is like
if (/,0 /) {
push @SELECT;
}
but much cleaner. I like that. The "push" I don't fully understand yet
I'll look that up next. Does it simply push the value in $_ into the
@SELECT array? Your right, I don't have a good handle on the grep yet.
I tried the command and got the syntax error everyone was talking
about.
>
> Can, but it's not the Perl way. Using the array in scalar context
> will give the number of elements.
>
> $i = @SELECT;
>
sweet. ok I don't want to use this unless I understanding it. Let me
give it a shot the $i is a scalar the @SELECT is an array. By setting
the scalar = to the array I create a reference. Now if I was to print
the value of the referent $1
print $1, "/n";
this would render the total number of values within the array @SELECT?
Is that what I understand here? if so that works well for the $TOTAL
and $FAIL values.
> : How would I count how many different types there are if I don't know
>
>See perldoc4, "How can I remove duplicate elements from a list or
array?" >It's not quite a direct answer, but the methodology is
there.
Thank you very much.
The docs are still new to me. I have read a couple so far. To see this
one I type.
perldoc4 -q remove duplicate elements
is that right?
------------------------------
Date: 24 Apr 2003 11:41:19 GMT
From: "Tassilo v. Parseval" <tassilo.parseval@rwth-aachen.de>
Subject: Re: Tough question for the guru's; Grep Once, Awk Twice (or more)
Message-Id: <b88igv$rc2$1@nets3.rz.RWTH-Aachen.DE>
Also sprach Bernard El-Hagin:
> Agrapha wrote:
>> btw thank you for driving me to it. I would have probably blown it off
>> as a place for fantasy armchair programmers but not after your post.
>
>
> Why would you think Tad cares? Can you say "killfile"?
Could we please put an end to all this noise? I think it has been
pointed out to the OP clearly enough what he did wrong (and he seems to
have understood). We should rather focus on the Perl-content of this
thread (now that it finally has such a thing).
Tassilo
--
$_=q#",}])!JAPH!qq(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus})!JAPH!qq(rehtona{tsuJbus#;
$_=reverse,s+(?<=sub).+q#q!'"qq.\t$&."'!#+sexisexiixesixeseg;y~\n~~dddd;eval
------------------------------
Date: 24 Apr 2003 11:49:34 GMT
From: "Tassilo v. Parseval" <tassilo.parseval@rwth-aachen.de>
Subject: Re: Tough question for the guru's; Grep Once, Awk Twice (or more)
Message-Id: <b88j0e$rre$1@nets3.rz.RWTH-Aachen.DE>
Also sprach Agrapha:
> tiltonj@erols.com (Jay Tilton) wrote in message news:<3ea76427.44366338@news.erols.com>...
>> You might be shooting for something like,
>>
>> while(<F>) {
>> push @SELECT, $_ if /,0 /;
>> }
>>
>
> whoa
> include the real expression /,0 / and not the literal string...That
> works.
> The "If " on the end is like
> if (/,0 /) {
> push @SELECT;
> }
> but much cleaner. I like that. The "push" I don't fully understand yet
> I'll look that up next. Does it simply push the value in $_ into the
> @SELECT array?
It does. You should consult the manpages for such things:
perldoc -f push
>> Can, but it's not the Perl way. Using the array in scalar context
>> will give the number of elements.
>>
>> $i = @SELECT;
>>
> sweet. ok I don't want to use this unless I understanding it. Let me
> give it a shot the $i is a scalar the @SELECT is an array. By setting
> the scalar = to the array I create a reference.
No, not until Perl6. The above simply assigns the number of elements of
@SELECT to $i. You can read about different contextes with
perldoc perldata
There is no reference involved in the above.
> Now if I was to print
> the value of the referent $1
>
> print $1, "/n";
>
> this would render the total number of values within the array @SELECT?
> Is that what I understand here? if so that works well for the $TOTAL
> and $FAIL values.
Did you mean $i instead of $1? The latter is something entirely
different (it has to do with regular expressions).
As for $i, it simply contains a number, nothing magic about it.
>> : How would I count how many different types there are if I don't know
>>
>>See perldoc4, "How can I remove duplicate elements from a list or
> array?" >It's not quite a direct answer, but the methodology is
> there.
>
> Thank you very much.
> The docs are still new to me. I have read a couple so far. To see this
> one I type.
>
> perldoc4 -q remove duplicate elements
No. The program to access all of Perl's documentation is simply
'perldoc'. To get the above you'd type
perldoc -q 'remove duplicate'
or
perldoc -q "remove duplicate"
if you use a Win32-ish shell.
This looks up a built-in function:
perldoc -f push
This queries the FAQs:
perldoc -q 'REGEXP'
And this brings up a whole manpage:
perldoc <MANPAGE>
for instance 'perldoc perlsyn'. A list of available manpages is here:
perldoc perl
'perldoc perldoc' will tell you what you can do with the perldoc program
itself. Knowing your perldocs will help you more than anything else on
the short, mid and long run.
Tassilo
--
$_=q#",}])!JAPH!qq(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus})!JAPH!qq(rehtona{tsuJbus#;
$_=reverse,s+(?<=sub).+q#q!'"qq.\t$&."'!#+sexisexiixesixeseg;y~\n~~dddd;eval
------------------------------
Date: 24 Apr 2003 04:51:28 -0700
From: brian@box201.com (Agrapha)
Subject: Re: Tough question for the guru's; Grep Once, Awk Twice (or more)
Message-Id: <11aabb15.0304240351.e15b91e@posting.google.com>
tiltonj@erols.com (Jay Tilton) wrote in message news:<3ea76724.45131918@news.erols.com>...
> tiltonj@erols.com (Jay Tilton) wrote:
>
> : See perldoc4, "How can I remove duplicate elements from a list or
> ^^^^^^^^
> perlfaq4, that is. Ugh.
I should read both your messages before I post. :)
------------------------------
Date: Thu, 24 Apr 2003 07:05:56 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Tough question for the guru's; Grep Once, Awk Twice (or more)
Message-Id: <slrnbafkp4.2rr.tadmc@magna.augustmail.com>
Agrapha <brian@box201.com> wrote:
[and some unattributed person wrote:]
>> > if I can only get complaints about posting then I shall look
>> > elsewhere.
>>
>>
>> Thank you.
>
> Oh no, I a perma-member now.
We'll see.
> Soley because of your post.
This group has survived many trolls more skilled than you,
we can survive yet another one.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Thu, 24 Apr 2003 12:31:55 +0000 (UTC)
From: "Bernard El-Hagin" <bernard.el-hagin@DODGE_THISlido-tech.net>
Subject: Re: Tough question for the guru's; Grep Once, Awk Twice (or more)
Message-Id: <Xns936793B1CA73Delhber1lidotechnet@62.89.127.66>
Also sprach Tassilo v. Parseval:
> Also sprach Bernard El-Hagin:
>
>> Agrapha wrote:
>
>>> btw thank you for driving me to it. I would have probably blown it off
>>> as a place for fantasy armchair programmers but not after your post.
>>
>>
>> Why would you think Tad cares? Can you say "killfile"?
>
> Could we please put an end to all this noise? I think it has been
> pointed out to the OP clearly enough what he did wrong (and he seems to
> have understood). We should rather focus on the Perl-content of this
> thread (now that it finally has such a thing).
Shirley.
:-)
--
Cheers,
Bernard
--
echo 42|perl -pe '$#="Just another Perl hacker,"'
------------------------------
Date: Thu, 24 Apr 2003 12:44:52 GMT
From: helgi@decode.is (Helgi Briem)
Subject: Re: Tough question for the guru's; Grep Once, Awk Twice (or more)
Message-Id: <3ea7dbaf.1201763424@news.cis.dfn.de>
On 24 Apr 2003 04:38:31 -0700, brian@box201.com (Agrapha)
wrote:
>>See perldoc4, "How can I remove duplicate elements from a list or
>array?" >It's not quite a direct answer, but the methodology is
>there.
>
>Thank you very much.
>The docs are still new to me. I have read a couple so far. To see this
>one I type.
>
>perldoc4 -q remove duplicate elements
>
>is that right?
Almost.
perldoc -q remove duplicate elements
or even
perldoc -q duplicate
The 4 is a typo, but comes from the fact that the
question is one of the many answered in the perlfaq4
document.
--
Regards, Helgi Briem
helgi DOT briem AT decode DOT is
------------------------------
Date: 24 Apr 2003 05:56:58 -0700
From: brian@box201.com (Agrapha)
Subject: Re: Tough question for the guru's; Grep Once, Awk Twice (or more)
Message-Id: <11aabb15.0304240456.724b1d07@posting.google.com>
tadmc@augustmail.com (Tad McClellan) wrote in message news:<slrnbaepl4.22d.tadmc@magna.augustmail.com>...
>
> You got it Grasshopper!
>
> my %error_codes;
> ... # determine code for an input line, put it into $this_code
> $error_codes{$this_code}++;
>
I don't have it yet. I don't understand what you mean when you say to
#determine code for an input line. I was going to load each errored
line into an @array and then pull @array[8] from it to get my error
code. The errored line would be any line containing the /,0 /
sequence. There is only 1 reason ",0 " exists and that is a errored
line meaning zero session time. the space after the ,0 is what makes
it unique. would I put:
my %error_codes;
while (<F>) {
push @SELECT, $_ if /,0 /;
$this_code = @SELECT[8];
$error_codes{$this_code}++;
}
Does that look right?
> > I get a ration..Even within my own company.
>
> So it isn't just us then.
>
> Maybe it is you.
Perhaps,
An Oreilly book documents the attitude here. [Learning Perl, Page 11,
second paragraph] In 48 hours I have learned a great deal. It could
have been learned without 1 ounce of flame retardant. Fortunately I
brought a 55 gallon drum of it.
------------------------------
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 4886
***************************************