[27801] in Perl-Users-Digest
Perl-Users Digest, Issue: 9165 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Apr 17 00:05:41 2006
Date: Sun, 16 Apr 2006 21:05:05 -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 Sun, 16 Apr 2006 Volume: 10 Number: 9165
Today's topics:
Re: Assignment of var without escape/interpolation <tadmc@augustmail.com>
Re: help: newbie extracting lines from large file. xhoster@gmail.com
Re: RXParse module (by robic0), Version 0.1000 <uri@stemsystems.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sun, 16 Apr 2006 20:04:42 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Assignment of var without escape/interpolation
Message-Id: <slrne45qda.1jr.tadmc@magna.augustmail.com>
Alan_C <mtbr0228AT@sbcglobalDOT.net> wrote:
> my $foo = 'bc' . $bar;
> Double quotes interpolates but (I guess) an operator can as well under
> certain circumstance -- like my code above, the concatenation operator.
There is no interpolation in your code above.
> The word context is coming up for me. I'm guessing here that context has
> to do with it (I could be wrong).
You are.
> But it seems that in the context of
> the operation (concatenation operator) that it knows to combine the bc
> string with the *content* of the $bar scalar variable.
"evaluating an expression" (as in your code above) and "interpolation"
are not the same thing.
Interpolation has only to do with strings, evaluating expressions
happens all over the place.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: 17 Apr 2006 01:01:25 GMT
From: xhoster@gmail.com
Subject: Re: help: newbie extracting lines from large file.
Message-Id: <20060416211412.018$Rr@newsreader.com>
Super-User <Super-User@mordor.net> wrote:
> i am trying to parse a something similar to this format.
> the staring line can be starting at any hour(line1)and last line can be
> any hour.
> when the day changes to the next day. the hour changes to 00 (line 12)
>
> how can i extract the first 11 lines
> (17:00 -> 23:38)
> then
> (00:01 -> 23:38)
> and so on and so on into individual files until end of the file
>
> basically i want to create a file for each 24 hours.
my $fh;
my $last_hour;
while (<>) {
my $hour=parse_hour($_);
if (!defined $last_hour or $hour < $last_hour) {
open $fh, next_file_name() or die $!;
$last_hour=$hour;
};
print $fh $_;
};
> the only
> thing consistent is the first 00 for each day.
> from the first occurrence of this /\[\d\] \[00:/
> till the line before its next occurrence and also extract
> the top portion (no 00 to start with) into seperate files.
What if there are no entries during the midnight hour, so it goes from
11 to 01?
Xho
--
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service $9.95/Month 30GB
------------------------------
Date: Sun, 16 Apr 2006 23:54:43 -0400
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: RXParse module (by robic0), Version 0.1000
Message-Id: <x7r73weu0s.fsf@mail.sysarch.com>
normally i avoid this troll and of course posting any code reviews of
his crappy modules. but i am still drawn to skim its code for laughs and
for future examples of how not to code in perl. and i came across this
nugget:
>>>>> "r" == robic0 <robic0> writes:
r> while ($$ref_parse_ln =~ /$RxParse/g)
r> {
r> ## handle contents
r> if (defined $14) {
r> $content .= $14;
and MUCH MUCH later:
r> $RxParse =
r> qr/(?:<(?:(?:(\/*)($Name)\s*(\/*))|(?:META(.*?))|(?:($Name)((?:\s+$Name\s*=\s*["'][^<]*['"])+)\s*(\/*))|(?:\?(.*?)\?)|(?:!(?:(?:DOCTYPE(.*?))|(?:\[CDATA\[(.*?)\]\])|(?:--(.*?[^-])--)|(?:ATTLIST(.*?))|(?:ENTITY(.*?)))))>)|(.+?)/s;
yes, that is one long line of regex with at least 14 grabs. read it and
weep. you may want to gouge out your eyes and i sympathize with you.
the regex is assigned way away from where it is used (and it's a
horrible regex to boot. does this moron really think he can parse SGML
type stuff with a regex?). but the use of $14 is one of the worst pieces
of perl code i have ever seen. and there is an amazing amount of bad
perl out there (easy to find on the web and in too much of cpan). but i
have never seen $14 used before. that takes a really microencephalic
brain to use a numbered grab that large, with such an ugly regex and
being so far away from the regex. but we know this troll well enough to
know it can code this poorly and now we have proof.
so flame back at me. take some of my cpan code and try to code review
it. hell, i would love to see you do that as you might even learn
something which is always possible, even for a lump of granite.
and this post is for google news searches so there is one post on record
which states that this code or any other by this troll should ever be
used. if it ever appears on cpan, i will lead a campaign (should be very
easy to do) to make sure its rating will approach negative infinity.
have fun,
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: 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.
NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
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 9165
***************************************