[29461] in Perl-Users-Digest
Perl-Users Digest, Issue: 705 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Aug 1 00:09:50 2007
Date: Tue, 31 Jul 2007 21:09:04 -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 Tue, 31 Jul 2007 Volume: 11 Number: 705
Today's topics:
Re: @arts <ether@invalid.email.net>
Re: @arts <v_r@spamless.and.happy>
Re: @arts <v_r@spamless.and.happy>
Re: @arts <tadmc@seesig.invalid>
A script to flag commonly misused words <ickyelf@gmail.com>
Re: A script to flag commonly misused words <1usa@llenroc.ude.invalid>
Re: A script to flag commonly misused words <usenet@larseighner.com>
Re: A script to flag commonly misused words <ickyelf@gmail.com>
Re: How do you continue in a for loop? usenet@DavidFilmer.com
Re: How do you continue in a for loop? <RedGrittyBrick@SpamWeary.foo>
map & MIME::Parser <hobbzilla@hotmail.com>
Re: NULL value question <jim@nnnnnnnnn.com>
Re: NULL value question <spamtrap@dot-app.org>
Re: Perl with DBI <hjp-usenet2@hjp.at>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 31 Jul 2007 21:14:26 GMT
From: Ether J <ether@invalid.email.net>
Subject: Re: @arts
Message-Id: <Xns997E90D96ACAFEther@130.133.1.4>
Tad McClellan <tadmc@seesig.invalid> wrote in
news:slrnfajjh8.p85.tadmc@tadmc30.sbcglobal.net:
> Mike Hartsough <michaellhartsough@sbcglobal.net> wrote:
>> Tad McClellan wrote:
>>> Mike Hartsough <michaellhartsough@sbcglobal.net> wrote:
>>>
>>>
>>> > I saw no proof offered by Michele Dondi nor Tad McClellan, who
>>> > decided to join in rather than point out the Posting Guidelines,
>>>
>>>
>>> Specifically because the Jsut troll deserves no better.
>>>
>>> (ie. this poster has a history here)
>>
>> So you're saying you have the right to accuse anyone of being this
>> "Jsut troll" without any evidence to prove it?
>
>
> No.
>
> And that did not happen in this thread as it slipped up yet again
> and revealed itself.
How do you get that? There was no "slip" up that I can see, and Tad's
own words (as you quoted above) prove you wrong. He provided absolute
squat in the way of evidence of his claim. Being on UseNet for about 25
years, that translates to the asserter being full of crap.
When it comes down to it, sometimes it seems like you "regulars"
purposely set "lesser" people up. I recently came across this example:
Message-ID: <Xns926A87C42CA4Edragnetinternalysisc@206.172.150.13>
(snippet of Marc Bissonnette's reply to Tad McCellan)
"tadmc@augustmail.com (Tad McClellan) wrote in
"news:slrnalktlj.am6.tadmc@magna.augustmail.com:
"
"> Marc Bissonnette <dragnet@internalysis.com> wrote:
[...]
"> Do you have warnings enabled?
"
"No, though I shall endeavour to do so in the future. I do check my code
"locally with perl -c scriptname.cgi as well as using
"use CGI::Carp qw(fatalsToBrowser);
Message-ID: <slrnall6eq.b71.tadmc@magna.augustmail.com>
(snippet of Tad McCellan's subsequent repy)
"Marc Bissonnette <dragnet@internalysis.com> wrote:
"> tadmc@augustmail.com (Tad McClellan) wrote in
"> news:slrnalktlj.am6.tadmc@magna.augustmail.com:
">> Marc Bissonnette <dragnet@internalysis.com> wrote:
[...]
">> Do you have warnings enabled?
">
"> No,
"
"
"Then I am through helping you.
"
"Good luck.
"
"(you should have "use strict;" turned on too)
I'd like to know what you call this? Can you tell me this is anything
but a deliberate omission? And if it wasn't it, why couldn't Tad at
least apologize for missing that?
And to add insult to injury, one of his supports jumps in with this:
Message-ID: <Pine.LNX.4.40.0208142102300.26688-100000@lxplus076.cern.ch>
(Alan J. Flavell reply to Marc Bissonnette reply to the previous post
above)
"On Aug 14, Marc Bissonnette inscribed on the eternal scroll:
"
"> ta...@augustmail.com (Tad McClellan) wrote in
"
"[..snip..]
"
"> Since you seem to feel so threatened, beleaguered and burdened when
"> answering posts from me, please don't trouble yourself, or cause such
"> extreme levels of mental duress by replying to me again, with or
"> without warnings and/or strictures.
"
"I haven't been following this thread, but that response, to a
"respected contributor here, earns a fast-track into the killfile
"without any need to check what went before.
So is Alan saying that it's perfectly ok for Tad, or any other
"respected contributor" to act anyway they want with complete impunity?
That Tad is automatically right and therefore doesn't even have to
check?? I don't know if I've ever seen a human head so far below sea
level.
Yes, Marc Bissonnette's second reply to Tad was over the top, I don't
deny that. He clearly went too far and could of handled it much better.
But it was also clearly not without reason. This is what happens when
you push at people and snip contextual information that completely
changes what was said... I would think experts of Perl would appreciate
the need for proper context.
This is one of many examples. If "regulars" like Tad, who should be
setting an example, would be more diplomatic and less eager to cast
people as unworthy and also stop "talking down", this would truly be a
better place.
Alas, I doubt any of you will listen. You've proved that far too many
times.
--
Ether J.
------------------------------
Date: Tue, 31 Jul 2007 14:19:41 -0700
From: "V.Ronans" <v_r@spamless.and.happy>
Subject: Re: @arts
Message-Id: <0-adnUy6verpOjLbnZ2dnUVZ_vWtnZ2d@wavecable.com>
anno4000@radom.zrz.tu-berlin.de wrote:
> Anno -- sigless since 1989
Is this not essentially a sig? I mean the "Anno" part, as you have it at
the end of all (most?) of your posts (so it's reoccuring), would that
not qualify as a sig, even if not a UseNet style "-- \n$sig" sig? :)
------------------------------
Date: Tue, 31 Jul 2007 14:24:10 -0700
From: "V.Ronans" <v_r@spamless.and.happy>
Subject: Re: @arts
Message-Id: <ZJCdnTIoG_jiNTLbnZ2dnUVZ_qy3nZ2d@wavecable.com>
anno4000@radom.zrz.tu-berlin.de wrote:
> Wade Ward <zaxfuuq@invalid.net> wrote in comp.lang.perl.misc:
>>
>> <anno4000@radom.zrz.tu-berlin.de> wrote in message
>> news:5h5m3jF3j4vb7U1@mid.dfncis.de...
>>> Wade Ward <zaxfuuq@invalid.net> wrote in comp.lang.perl.misc:
>>
>>>> My compiler takes a puke on line 7, which is a use statement.
>>>> Does this not
>>>> mean that I need to install another module on my machine?
>>>
>>> Not if Clikey.pm is in your current directory.
>> I don't see it in the bin.
>
> It's yours. You got to put it there.
>
>> What I don't undertstand is that all the garbage
>> in there didn't sort itself with a dir command. Tja.
>
> Huh?
>
> Anno
`dir` on linux outputs in a (string) sorted way. On Win32, `dir` gives a
seeming random "directory order", however, `dir /O` gives sorted output.
You can also find `ls.exe` ports and source for Win32.
------------------------------
Date: Wed, 01 Aug 2007 02:05:55 GMT
From: Tad McClellan <tadmc@seesig.invalid>
Subject: Re: @arts
Message-Id: <slrnfavqcf.5d7.tadmc@tadmc30.sbcglobal.net>
Ether J <ether@invalid.email.net> wrote:
> Tad McClellan <tadmc@seesig.invalid> wrote in
> news:slrnfajjh8.p85.tadmc@tadmc30.sbcglobal.net:
>
>> Mike Hartsough <michaellhartsough@sbcglobal.net> wrote:
>>> Tad McClellan wrote:
>>>> Mike Hartsough <michaellhartsough@sbcglobal.net> wrote:
>>>>
>>>>
>>>> > I saw no proof offered by Michele Dondi nor Tad McClellan, who
>>>> > decided to join in rather than point out the Posting Guidelines,
>>>>
>>>>
>>>> Specifically because the Jsut troll deserves no better.
>>>>
>>>> (ie. this poster has a history here)
>>>
>>> So you're saying you have the right to accuse anyone of being this
>>> "Jsut troll" without any evidence to prove it?
>>
>>
>> No.
>>
>> And that did not happen in this thread as it slipped up yet again
>> and revealed itself.
>
> How do you get that?
Message-ID: <5gm6v5F3f95neU1@mid.dfncis.de>
> There was no "slip" up that I can see,
If you could see them, then you wouldn't repeat them ad infinitum.
> Being on UseNet for about 25
> years,
Golly. We all admire you now! Bask in the glow.
> When it comes down to it, sometimes it seems like you "regulars"
> purposely set "lesser" people up. I recently came across this example:
From 2002?
Probably because I've been so nice over the last 5 years...
> Message-ID: <Xns926A87C42CA4Edragnetinternalysisc@206.172.150.13>
> (snippet of Marc Bissonnette's reply to Tad McCellan)
>
> "tadmc@augustmail.com (Tad McClellan) wrote in
> "news:slrnalktlj.am6.tadmc@magna.augustmail.com:
> "
> "> Marc Bissonnette <dragnet@internalysis.com> wrote:
> [...]
> "> Do you have warnings enabled?
> "
> "No, though I shall endeavour to do so in the future. I do check my code
> "locally with perl -c scriptname.cgi as well as using
> "use CGI::Carp qw(fatalsToBrowser);
>
>
> Message-ID: <slrnall6eq.b71.tadmc@magna.augustmail.com>
> (snippet of Tad McCellan's subsequent repy)
>
> "Marc Bissonnette <dragnet@internalysis.com> wrote:
> "> tadmc@augustmail.com (Tad McClellan) wrote in
> "> news:slrnalktlj.am6.tadmc@magna.augustmail.com:
> ">> Marc Bissonnette <dragnet@internalysis.com> wrote:
> [...]
> ">> Do you have warnings enabled?
> ">
> "> No,
> "
> "
> "Then I am through helping you.
> "
> "Good luck.
> "
> "(you should have "use strict;" turned on too)
>
>
> I'd like to know what you call this?
I'd call it Marc saying that he would use warnings and then
not using warnings.
> Can you tell me this is anything
> but a deliberate omission?
It was a deliberate omission.
> And if it wasn't it,
Huh?
> why couldn't Tad at
> least apologize for missing that?
I could of, if I had missed that.
heh.
> Yes, Marc Bissonnette's second reply to Tad was over the top, I don't
> deny that. He clearly went too far and could of handled it much better.
From: Marc Bissonnette <dragnet@internalysis.com>
Date: Tue, 13 Jan 2004 20:03:21 GMT
Message-ID: <Xns946F992D8FD64dragnetinternalysisc@207.35.177.135>
Tad McClellan <tadmc@magna.augustmail.com> wrote in
news:slrnc08fsc.30m.tadmc@magna.augustmail.com:
> Marc Bissonnette <dragnet@internalysis.com> wrote:
>
>
>> As an aside and a belated thanks, a couple of years ago, you and Tad
>> McClellan took the time to explain why my demo code was severely
>> lacking when not using 'use strict' and 'use warnings' - While I was
>> a little thick-headed at the time,
>
> Enough so that I killfiled you at that time.
>
> Message-ID: <Xns926A95D5F2F8dragnetinternalysisc@206.172.150.13>
Yeah, I know - that was stupid of me - no excuses. Given that I *had* been
lurking for years before, I should have known better - All I can offer is
an ambarrassed apology.
>> the lesson eventually sunk in and did indeed
>> save me a *ton* of debugging time - much belated thanks!
>
> Golly, that's almost enough for me to reconsider...
Well, my pride ended up costing me in terms of inefficient code and much
time wasted. The irony is that now that the code I'm writing has to do a
lot more than just display some text on a web site and do some actual work,
I've discovered - the hard way - that the rules and guidelines that you
folks keep hammering into the newbs really *do* make life easier.
FWIW, thanks for the time you (and all the grizzled veterans in clpm) put
into supporting the community - newbs and old-hands alike. Some of us do
eventually learn the lessons :)
Kinda validates that my methods work.
Thanks for posting your support for me.
> Alas, I doubt any of you will listen.
That happens a lot to trolls.
Get used to it.
--
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"
------------------------------
Date: Tue, 31 Jul 2007 22:35:00 GMT
From: David Delony <ickyelf@gmail.com>
Subject: A script to flag commonly misused words
Message-Id: <oOOri.232$3x.209@newssvr25.news.prodigy.net>
This is my first real program, and being a good open source citizen, I'd
like to share it. It flags what Strunk and White thought were commonly
misued words and expressions. Share and enjoy!
#! /usr/bin/perl -w
=head1 NAME
misused_words - flag common usage errors in text
=head1 SYNOPSIS
misused_words [filename]
=head1 DESCRIPTION
miused_words takes files or standard input if no filename is given, and
checks
for commonaly misused words as defined and Strunk and White's "Elements of
Style." The program prints lines where misued words are found, with the
matches
in square brackets. The user should then consider revising the line.
=head1 AUTHOR
David Delony <ickyelf@gmail.com>
=head1 BUGS
The program is not nearly as smart as a human proofreader, only faster.
=head1 SEE ALSO
William Strunk, Jr., E.B. White, I<The Elements of Style> 4th Ed.
Allyn & Bacon, 2000. ISBN 0-205-30902-X
=head1 COPYRIGHT
Copyright (c) 2007 David Delony. All Rights Reserved.
This program is free software. You may copy or redistribute it under the
same
terms as Perl itself.
=cut
use strict;
while (<>) { # Our friend, the magic filehandle.
&word_check;
}
sub flag() {
chomp;
print "$.:$`\[$&\]$'\n"; #Print a line number and the line with
pattern match
} # in brackets.
sub word_check () { # Brace yourself, it's going to be a long one!
&flag if /aggravat|irritat/i; # aggravate or irratate. Allowing for
gerunds.
&flag if /all right/i;
&flag if /allud|allusion/i; # Allude and friends
&flag if /alternate|alternative/;
&flag if /among|between/i;
&flag if /and\/or/i;
&flag if /anticipat/i; # Anticipate, anticipation.
&flag if /anybody/i;
&flag if /anyone/i;
&flag if /as good or better than/i;
&flag if /as to whether/i;
&flag if /as yet/i;
&flag if /being/i;
&flag if /but/i;
&flag if /can/i; # Troublesome word, but great band!
&flag if /care less/i;
&flag if /case/i;
&flag if /certainly/i;
&flag if /character/i;
&flag if /claim/i;
&flag if /clever/i;
&flag if /compar/i; # Compare, comparing.;
&flag if /compris/i;# Comprise, comprising.
&flag if /consider/i;
&flag if /contact/i;
&flag if /cope|coping/i;
&flag if /currently/i;
&flag if /data/i;
&flag if /different than/i;
&flag if /disinterested/i;
&flag if /divided into/i;
&flag if /due to/i;
&flag if /each and every one/i;
&flag if /effect/i;
&flag if /enormity/i;
&flag if /enthuse/i;
&flag if /etc/i;
&flag if /fact/i;
&flag if /facilit/i; # Ugh, "facilities.";
&flag if /factor/i;
&flag if /farther|further/i;
&flag if /feature/i;
&flag if /finalize/i;
&flag if /fix/i;
&flag if /flammable/i;
&flag if /folk/i; # This program hates folk music.
&flag if /fortuitous/i;
&flag if /got/i;
&flag if /gratuitous/i; # We will not have any gratuitous sax or
violins in our program!
&flag if /is a.who|that/i; # "He is a man who" and other constructions.
&flag if /hopefully/i;
&flag if /however/;
&flag if /illusion/i;
&flag if /imply|impli|infer/i; # Imply, infer. Different words.
&flag if /importanly/i;
&flag if /in regard to/i;
&flag if /in the last analysis/i;
&flag if /inside/i;
&flag if /insightful/i;
&flag if /in terms of/i;
&flag if /interesting/i;
&flag if /irregardless/i; # That's not even a word!
&flag if /ize/i; # PHB "-ize" contructions.
&flag if /kind of/i;
&flag if /lay/i;
&flag if /leave/i;
&flag if /less/i;
&flag if /like/i;
&flag if /line|along these lines/i;
&flag if /literal|literally/i;
&flag if /loan/i;
&flag if /meaningful/i;
&flag if /memento/i;
&flag if /most/i;
&flag if /nature/i;
&flag if /nauseous|nauseated/i;
&flag if /nice/i;
&flag if /nor/i;
# Right here is where I would flag nouns used as verbs, but I think
that is an NP-complete problem
&flag if /one/i;
&flag if /one of the most/i;
&flag if /oriented/i;
&flag if /partially/i;
&flag if /ing/i; # participle check.
&flag if /people/i;
&flag if /personal/i;
&flag if /posess/i;
&flag if /presently/i;
&flag if /prestigoius/i;
&flag if /refer/i;
&flag if /regeretful/i;
&flag if /relate/i;
&flag if /respective/i;
&flag if /firstly|secondly|thirdly|fourthly/i;
&flag if /shall|will/i;
&flag if /so/i;
&flag if /sort of/i;
&flag if /to.*ly/i; # Split infinitive check
&flag if /state/i;
&flag if /student body/i;
&flag if /than/i;
&flag if /thank* in advance/i;
&flag if /that|which/i;
&flag if /the foreseeable future/i;
&flag if /the* is/i; # The truth is, the fact is.
&flag if /they|he|she/i;
&flag if /this/i;
&flag if /thrust/i;
&flag if /tortuous|torturous/i;
&flag if /try/i;
&flag if /type/i;
&flag if /unique/i;
&flag if /utilize/i; # That word drives me nuts!
&flag if /verbal/i;
&flag if /very/i;
&flag if /while/i;
&flag if /\w+wise/i; # "-wise" words
&flag if /worth.while/i;
&flag if /would/i;
} # Phew!
------------------------------
Date: Wed, 01 Aug 2007 01:22:40 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: A script to flag commonly misused words
Message-Id: <Xns997ED97ECDF29asu1cornelledu@127.0.0.1>
David Delony <ickyelf@gmail.com> wrote in
news:oOOri.232$3x.209@newssvr25.news.prodigy.net:
> This is my first real program,
Unfortunately, you ignored the primary principle of programming: Don't
repeat yourself.
Think for a second: Each time a new word is added to the list of words
to be flagged, you need to alter your program. That is not a good thing.
> #! /usr/bin/perl -w
>
use warnings;
is preferable in general as it allows you to scope warnings.
>
> use strict;
>
Good!
> while (<>) { # Our friend, the magic filehandle.
>
> &word_check;
> }
You don't need the & to invoke a subroutine. Using it has certain side
effects. If you do not know what they are and do not explicitly want
those, don't use & to invoke subs.
You are not passing arguments to subs and you are relying on the
contents of $_ not changing within the program flow.
Unfortunately, your lines are too wide and they wrap making it necessary
to edit your post to be able to test it. Don't do that.
> sub flag() {
>
> chomp;
>
> print "$.:$`\[$&\]$'\n"; #Print a line number and the line with
> pattern match
Using the pre- and post-match variables imposes a speed penalty on every
regex operation in your program.
> sub word_check () { # Brace yourself, it's going to be a long one!
But there is no need for it to be this long and this tedious.
So, I first wrote a script to extract the words to flag from your
script:
#!/usr/bin/perl
use strict;
use warnings;
while ( <> ) {
if ( m!^\s+&flag.+/(.+)/! ) {
print "$1\n";
}
}
__END__
C:\Home\asu1\src\New Folder> perl s.pl < t.pl > words
Now, the words file contains the words to flag. I am going to include
these words in the __DATA__ section of the following script for
convenience.
In the process, I discovered that at least one of the expressions you
used is wrong.
/is a.who|that/i; # "He is a man who" and other constr
A single solitary dot will only match one character. Second, the word
that in this expression will match by itself. You need a set of non-
capturing grouping parantheses around such expressions.
/thank* in advance/i;
I don't think you are really looking for
than in advance
thank in advance
thankkkkkk in advance
but rather want to match "thanks in advance". Well, at least I am glad
to have found out that I am not the only one who considers this phrase
rude and unnecessary.
/thank\w+ in advance/
would have been better.
The problem, of course, is that such expressions can span two lines. The
script I give below would also fail to match in such cases but I am too
lazy to fix it right now.
Please note that the purpose of this critique is not to discourage you
but to help you improve. Hope it helps.
As it stands, the script will give false positives. For example,
test(71):[Than]ks in advance
test(71):[Thanks in advance]
Again, I am too lazy to figure out how to do everything right.
However, I hope the following script will illustrate to you a way of
reducing your work:
#! /usr/bin/perl
use strict;
use warnings;
my @regexps;
while ( my $s = <DATA> ) {
$s =~ s/^\s+//;
$s =~ s/\s+$//;
next unless length $s;
push @regexps, qr/$s/i;
}
while (my $input = <>) {
WORD_CHECK: for my $r ( @regexps ) {
if ( (my $checked = $input) =~ s/($r)/[$1]/g ) {
print "$ARGV($.):$checked";
}
}
}
__DATA__
aggravat|irritat
all right
allud|allusion
alternate|alternative
among|between
or
anticipat
anybody
anyone
as good or better than
as to whether
as yet
being
but
can
care less
case
certainly
character
claim
clever
compar
compris
consider
contact
cope|coping
currently
data
different than
disinterested
divided into
due to
each and every one
effect
enormity
enthuse
etc
fact
facilit
factor
farther|further
feature
finalize
fix
flammable
folk
fortuitous
got
gratuitous
is a \w+ (?:who|that)
hopefully
however
illusion
imply|impli|infer
importanly
in regard to
in the last analysis
inside
insightful
in terms of
interesting
irregardless
ize
kind of
lay
leave
less
like
line|along these lines
literal|literally
loan
meaningful
memento
most
nature
nauseous|nauseated
nice
nor
one
one of the most
oriented
partially
ing
people
personal
posess
presently
prestigoius
refer
regeretful
relate
respective
firstly|secondly|thirdly|fourthly
shall|will
so
sort of
to.*ly
state
student body
than
thank\w+ in advance
that|which
the foreseeable future
the* is
they|he|she
this
thrust
tortuous|torturous
try
type
unique
utilize
verbal
very
while
\w+wise
worth.while
would
Sinan
--
A. Sinan Unur <1usa@llenroc.ude.invalid>
(remove .invalid and reverse each component for email address)
comp.lang.perl.misc guidelines on the WWW:
http://augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html
------------------------------
Date: 01 Aug 2007 01:42:21 GMT
From: Lars Eighner <usenet@larseighner.com>
Subject: Re: A script to flag commonly misused words
Message-Id: <slrnfavp5d.os.usenet@goodwill.larseighner.com>
In our last episode, <oOOri.232$3x.209@newssvr25.news.prodigy.net>, the
lovely and talented David Delony broadcast on comp.lang.perl.misc:
> This is my first real program, and being a good open source citizen, I'd
> like to share it. It flags what Strunk and White thought were commonly
> misued words and expressions. Share and enjoy!
The first rule in real programming is research. Seems 'diction' has done
this for years, has some modest phrase handling and suggestion ability, and
although it started with Strunk & White, has acquire many other items and
comes in several language flavors, allowing a supplemental rules file from
the user with or without disabling the default file.
A real advance would be to give diction a nice curses interface and stream
handling abilities like aspell or ispell.
--
Lars Eighner <http://larseighner.com/> <http://myspace.com/larseighner>
Countdown: 538 days to go.
Owing to massive spam from googlegroups, I do not see most posts from there.
------------------------------
Date: Wed, 01 Aug 2007 04:05:06 GMT
From: David Delony <ickyelf@gmail.com>
Subject: Re: A script to flag commonly misused words
Message-Id: <SDTri.54353$5j1.28879@newssvr21.news.prodigy.net>
On Wed, 01 Aug 2007 01:22:40 +0000, A. Sinan Unur wrote:
> Please note that the purpose of this critique is not to discourage you
> but to help you improve. Hope it helps.
I appreciate the suggestions. I was hoping the Perl hackers would help me
see better ways of implenting this program. Bitter medicice, perhaps. but
the patient needs it. :-)
------------------------------
Date: Tue, 31 Jul 2007 22:21:43 -0000
From: usenet@DavidFilmer.com
Subject: Re: How do you continue in a for loop?
Message-Id: <1185920503.720389.323620@g12g2000prg.googlegroups.com>
On Jul 31, 11:45 am, Paul Lalli <mri...@gmail.com> wrote:
> C++ 'continue' ==> Perl 'next'
> C++ 'break' ==> Perl 'last'
And as a matter of Perlish style:
C++ 'for (my $i = 0; $i < 10; ++$i)' => Perl 'foreach my $i( 0..9 )'
(you can use 'for' if you like - I find 'foreach' reads better)
And, of course, $i is a terrible variable name.
--
The best way to get a good answer is to ask a good question.
David Filmer (http://DavidFilmer.com)
------------------------------
Date: Tue, 31 Jul 2007 23:27:29 +0100
From: RedGrittyBrick <RedGrittyBrick@SpamWeary.foo>
Subject: Re: How do you continue in a for loop?
Message-Id: <HYydnSt7QeTMKjLbnZ2dnUVZ8sSrnZ2d@bt.com>
Azazel wrote:
> On 2007-07-31, Azazel <azazel@azazel.net> wrote:
>> On 2007-07-31, Thierry <lamthierry@gmail.com> wrote:
>>> In other languages, the for loop has a continue statement feature to
>>> skip an interation, how do you do it in perl?
>> "next". For example:
>>
>> for (my $i = 0; $i < 10; ++$i)
>> {
>> if ($i == 7)
>> {
>> next;
>> }
>> else
>> {
>> print $i, "\n";
>> }
>> }
>
> Or rather:
>
> for (my $i = 0; $i < 10; ++$i)
> {
> if ($i == 7)
> {
> next;
> }
>
> print $i, "\n";
> }
or
for $i (1..10) {
next if $i == 7;
print "$i\n";
}
or
perl -e "$\=qq(\n); for (1..10) { next if $_==7; print }"
TIMTOWTDI
------------------------------
Date: Tue, 31 Jul 2007 17:11:38 -0700
From: hobbzilla <hobbzilla@hotmail.com>
Subject: map & MIME::Parser
Message-Id: <1185927098.080572.137880@e16g2000pri.googlegroups.com>
What is the equivelent of this code?
map ({$_->bodyhandle->path() } @parts))
It appears to be returning something like this /tmp/path/filename.txt/
tmp/path/filename2.txt/tmp/path/filename3.txt - I really need it to
send /tmp/path/filename2.txt /tmp/path/filename3.txt (so long as /tmp/
path/filename.txt is the email body of the message -- I want the body
discarded and just need the attachments..
Please advise.
The original script I am referencing is located here:
http://people.ifax.com/~aidan/hylafax/mail2fax/mail2fax.pl.txt
------------------------------
Date: Tue, 31 Jul 2007 16:29:55 -0400
From: Jim James <jim@nnnnnnnnn.com>
Subject: Re: NULL value question
Message-Id: <MPG.211965cd8d6deb298968d@news.newshosting.com>
In article <MPG.211951b1631c501998968c@news.newshosting.com>,
jim@nnnnnnnnn.com says...
> I'm coding my first web site using a mysql
> database and DBI.
>
> I can fetch records from the database
> with no problem, but I'm having trouble
> testing NULL values. If I load the value
> of a date field into a variable ($dateadded),
> how should the IF condition be written?
>
if (!defined $dateadded) works perfectly!
Thanks to all who responded!
------------------------------
Date: Tue, 31 Jul 2007 17:18:55 -0400
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: NULL value question
Message-Id: <m2myxc6zls.fsf@dot-app.org>
Jim James <jim@nnnnnnnnn.com> writes:
> In article <MPG.211951b1631c501998968c@news.newshosting.com>,
> jim@nnnnnnnnn.com says...
>> I'm coding my first web site using a mysql
>> database and DBI.
>>
>> I can fetch records from the database
>> with no problem, but I'm having trouble
>> testing NULL values. If I load the value
>> of a date field into a variable ($dateadded),
>> how should the IF condition be written?
>>
> if (!defined $dateadded) works perfectly!
Note that, if what you want to do is filter out records for which a certain
field is NULL, you're probably better off doing that in your SQL, with an
IS NOT NULL clause in your conditional:
SELECT foo, bar FROM baz WHERE foo IS NOT NULL
AND bar >= 30
sherm--
--
Web Hosting by West Virginians, for West Virginians: http://wv-www.net
Cocoa programming in Perl: http://camelbones.sourceforge.net
------------------------------
Date: Tue, 31 Jul 2007 23:13:59 +0200
From: "Peter J. Holzer" <hjp-usenet2@hjp.at>
Subject: Re: Perl with DBI
Message-Id: <slrnfav9gn.4c5.hjp-usenet2@zeno.hjp.at>
On 2007-07-31 18:07, Brian Blackmore <blb8@po.cwru.edu> wrote:
> Peter J. Holzer <hjp-usenet2@hjp.at> wrote:
>> On 2007-07-29 22:57, Jason <jwcarlton@gmail.com> wrote:
>> > With the ID field, I'm wanting to create a unique ID for each new
>> > submission. I was originally using auto_increment, but the problem is
>> > that when I remove a row, I do not want the ID to be reused.
>
>> For MySQL, depends on the database engine. For MyISAM tables,
>> auto_increment values are not reused, but for InnoDB, they are.
>> Also the behavior changed at least once, and may change again in the
>> future, so you shouldn't rely on it.
>
>> Oracle has sequences instead of auto_increment columns, which are
>> guarantueed to be never reused. You can simulate them in MySQL with a
>> table with just one value, which you increment programmatically (but you
>> have to lock it to prevent concurrent access).
>
> Most reasonable databases have sequences;
Yes. I only wanted to mention Oracle as an example, not imply that
sequences are specific to Oracle.
Sorry if I wasn't clear.
hp
--
_ | Peter J. Holzer | I know I'd be respectful of a pirate
|_|_) | Sysadmin WSR | with an emu on his shoulder.
| | | hjp@hjp.at |
__/ | http://www.hjp.at/ | -- Sam in "Freefall"
------------------------------
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 V11 Issue 705
**************************************