[25463] in Perl-Users-Digest
Perl-Users Digest, Issue: 7708 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Jan 29 11:05:50 2005
Date: Sat, 29 Jan 2005 08:05:16 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Sat, 29 Jan 2005 Volume: 10 Number: 7708
Today's topics:
Re: FAQ 4.35 How do I find the soundex value of a strin <groleau+news@freeshell.org>
Re: Old tutorial - now corrected <tadmc@augustmail.com>
Re: Old tutorial - now corrected <Juha.Laiho@iki.fi>
Perl loops should use break, not last <ask@me.com>
Regular Expression Question on /i amyl@paxemail.com
Re: Regular Expression Question on /i <ddog@dixiebill.com>
Re: Regular Expression Question on /i <jurgenex@hotmail.com>
Re: Regular Expression Question on /i <tadmc@augustmail.com>
Re: regular expression question <tadmc@augustmail.com>
Re: regular expression question <noelt.dolan@virgin.net>
Re: regular expression question <noelt.dolan@virgin.net>
Re: regular expression question <noreply@gunnar.cc>
Re: regular expression question <noeltd@hotmail.com>
remove junk characters <bckumari@yahoo.com>
Re: remove junk characters <nobull@mail.com>
Re: Search Through List <tadmc@augustmail.com>
Re: Search Through List <news@chaos-net.de>
Re: Search Through List <tadmc@augustmail.com>
Re: Starting Point for backup script <dontmewithme@got.it>
Re: Starting Point for backup script <bart.lateur@pandora.be>
Re: what's OOP's jargons and complexities? <gdr@integrable-solutions.net>
Re: what's OOP's jargons and complexities? <jacob@jacob.remcomp.fr>
Re: what's OOP's jargons and complexities? <mambuhl@earthlink.net>
Re: what's OOP's jargons and complexities? <kst-u@mib.org>
Re: what's OOP's jargons and complexities? <cbfalconer@yahoo.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 28 Jan 2005 22:46:01 -0500
From: Wes Groleau <groleau+news@freeshell.org>
Subject: Re: FAQ 4.35 How do I find the soundex value of a string?
Message-Id: <F7WdnVwTm_Zpm2bcRVn-iQ@gbronline.com>
PerlFAQ Server wrote:
> think it is. Knuth's soundex algorithm compresses words into a small
> space, and so it does not necessarily distinguish between two words
> which you might want to appear separately. For example, the last names
> `Knuth' and `Kant' are both mapped to the soundex code K530. If
Why do the FAQers call it "Knuth's soundex algorithm" ? Did Knuth
invent a particularly elegant way to generate Soundex? The Soundex
encoding scheme itself is older than Knuth.
OK, I think I get most of the answer here:
http://west-penwith.org.uk/misc/soundex.htm
--
Wes Groleau
Armchair Activism: http://www.breakthechain.org/armchair.html
------------------------------
Date: Fri, 28 Jan 2005 22:31:59 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Old tutorial - now corrected
Message-Id: <slrncvm4dv.5hg.tadmc@magna.augustmail.com>
binnyva@hotmail.com <binnyva@hotmail.com> wrote:
> But none of you
> have convinced me to take the tutorial offline.
Then you are a pox on the Perl community.
I don't like you because you hurt my friends.
> Rather
> than pointing out what was wrong with the tutorial and
> how to correct it,
There was much pointing out of what was wrong with the
tutorial and not much correcting of that which was
pointed out.
> what you did was claim that I was
> unqualified to write it in the first place.
Because you are.
> So it is natural that there would be some problems
> with them.
Why do you want to infect others with those problems?
> Those scripts was not intended for students of perl;
Then don't point students of Perl to them!
> My goal in writing the tutorial was to provide a
> introduction to perl.
Our goal is to help our fellow Perl programmers by warning
them off of your tutorial at every opportunity.
> I tried to create
> a tutorial that was easy to read and not hard
> to understand.
Try creating a tutorial that is *correct* for a change.
> At the same time, in many ways, I had been stubborn
> too.
Amen brother!
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Sat, 29 Jan 2005 08:17:17 +0000 (UTC)
From: Juha Laiho <Juha.Laiho@iki.fi>
Subject: Re: Old tutorial - now corrected
Message-Id: <ctfgqd$snh$2@ichaos.ichaos-int>
binnyva@hotmail.com said:
>Most of the programs there are very old relics - about
>two to three years old - I am too lazy to update them.
>I should do that - I know. Maybe sometime this year...
Regarding the problem that sparked this thread (date formatting),
that kind of thing was much of the routine crap to correct before
year 2000: there was a lot of code that took the year as returned
by localtime, and concatenated the result with text '19'. This
resulted in years being shown as '19100' when the year turned to
2000, and the problem was widely published, along with the always
correct way to write this (to add a numeric 1900 to the year number
returned from the localtime call). And 2-3 years ago (2002-2003?),
you had managed to have forgotten about the y2k problem to create
year 2010 problem?
--
Wolf a.k.a. Juha Laiho Espoo, Finland
(GC 3.0) GIT d- s+: a C++ ULSH++++$ P++@ L+++ E- W+$@ N++ !K w !O !M V
PS(+) PE Y+ PGP(+) t- 5 !X R !tv b+ !DI D G e+ h---- r+++ y++++
"...cancel my subscription to the resurrection!" (Jim Morrison)
------------------------------
Date: Sat, 29 Jan 2005 15:42:53 -0000
From: "Jeremy Morton" <ask@me.com>
Subject: Perl loops should use break, not last
Message-Id: <41fbaeb9$0$26027$fa0fcedb@news.zen.co.uk>
Probably been mentioned before but I fail to see why Perl changed the
'break' keyword to 'last', in loops. Bear with me on this - it seems
semantically more accurate to say 'break' - you're immediately breaking out
of the loop. 'last' makes it sound like the current loop will be the last,
but not that the execution should be stopped immediately, whereas break
makes it sound like the latter.
Where can I propose that this be changed, or break aliased to last, for Perl
6?
--
Best regards,
Jeremy Morton (Jez)
------------------------------
Date: 28 Jan 2005 20:59:27 -0800
From: amyl@paxemail.com
Subject: Regular Expression Question on /i
Message-Id: <1106974766.986096.224220@c13g2000cwb.googlegroups.com>
I was playing around with some regular expressions in Perl and I
noticed some of them have the following character in them "/i".
For example:
\b(?:college|university)\s+diplomas/i
I can't seem to find any info on what /i is. Can anyone shed some
light on /i?
Thanks
Amy.
------------------------------
Date: Sat, 29 Jan 2005 06:01:23 GMT
From: ddog <ddog@dixiebill.com>
Subject: Re: Regular Expression Question on /i
Message-Id: <Xns95EDA8C28761deputydogdixiebill@68.12.19.6>
On 28 Jan 2005, the Good amyl@paxemail.com made the following observation
in comp.lang.perl.misc:
> I was playing around with some regular expressions in Perl and I
> noticed some of them have the following character in them "/i".
>
> For example:
> \b(?:college|university)\s+diplomas/i
>
> I can't seem to find any info on what /i is. Can anyone shed some
> light on /i?
>
> Thanks
> Amy.
>
>
Case-insensitive operator. /Dummytext/ matches exactly "Dummytext" but
/Dummytext/i matches "DUMMYTEXT, DuMmYTEXT,..." and so on.
--
------------------------------
Date: Sat, 29 Jan 2005 06:22:14 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Regular Expression Question on /i
Message-Id: <qYFKd.406$To.26@trnddc09>
amyl@paxemail.com wrote:
> I was playing around with some regular expressions in Perl and I
> noticed some of them have the following character in them "/i".
>
> For example:
> \b(?:college|university)\s+diplomas/i
>
> I can't seem to find any info on what /i is. Can anyone shed some
> light on /i?
perldoc perlre:
i Do case-insensitive pattern matching.
If "use locale" is in effect, the case map is taken from the current
locale. See the perllocale manpage.
jue
------------------------------
Date: Sat, 29 Jan 2005 07:50:06 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Regular Expression Question on /i
Message-Id: <slrncvn54e.6vb.tadmc@magna.augustmail.com>
amyl@paxemail.com <amyl@paxemail.com> wrote:
> I was playing around with some regular expressions in Perl and I
> noticed some of them have the following character in them "/i".
^^^^^^^
^^^^^^^
No they don't.
(shouldn't that be "following characters" since there is more
than one of them?
)
> For example:
> \b(?:college|university)\s+diplomas/i
The "i" is not in a regular expression there, the "i" is part
of an *operator* that makes use of regular expressions.
You show the ending delimiter but not the corresponding opening one:
/\b(?:college|university)\s+diplomas/i
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The underlined part, between the slashes, is a regular expression.
The match operator takes a regular expression as one of its operands.
> I can't seem to find any info on what /i is.
Where did you look?
(maybe you are missing out on some helpful references...)
> Can anyone shed some
> light on /i?
Now that we know that we have a question about an operator
rather than about a regular expression, we look it up where
we look up all of Perl's operators:
perldoc perlop
...
i Do case-insensitive pattern matching.
...
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Fri, 28 Jan 2005 22:11:25 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: regular expression question
Message-Id: <slrncvm37d.5hg.tadmc@magna.augustmail.com>
Atlantis <noelt.dolan@virgin.net> wrote:
> if ($Record =~ /\s*(abc|def|ghi)\d{5}\.{1}\s*/)
^^^
Why do you include the {1} ?
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Sat, 29 Jan 2005 12:28:02 GMT
From: "Atlantis" <noelt.dolan@virgin.net>
Subject: Re: regular expression question
Message-Id: <mjLKd.160$A01.130@newsfe2-win.ntli.net>
"Tad McClellan" <tadmc@augustmail.com> wrote in message
news:slrncvm37d.5hg.tadmc@magna.augustmail.com...
> Atlantis <noelt.dolan@virgin.net> wrote:
>
> > if ($Record =~ /\s*(abc|def|ghi)\d{5}\.{1}\s*/)
> ^^^
>
> Why do you include the {1} ?
>
No good reason other than just thought it added clarity to the statement.
(Obviously statement works without it too.)
Would probably revise the statement to look like...
if ($Record =~ /^(abc|def|ghi)\d{5}\.$/)
------------------------------
Date: Sat, 29 Jan 2005 12:29:04 GMT
From: "Atlantis" <noelt.dolan@virgin.net>
Subject: Re: regular expression question
Message-Id: <kkLKd.161$A01.98@newsfe2-win.ntli.net>
"Gunnar Hjalmarsson" <noreply@gunnar.cc> wrote in message
news:360942F4rhiniU1@individual.net...
> Atlantis wrote:
> >
> > if ($Record =~ /\s*(abc|def|ghi)\d{5}\.{1}\s*/)
> > # Checks for leading and trailing white spaces.
>
> In what way does the regex check for leading and trailing white spaces?
> Which strings would it match that are not matched by:
>
> /(abc|def|ghi)\d{5}\./
>
> (or vice versa) ??
>
> --
> Gunnar Hjalmarsson
> Email: http://www.gunnar.cc/cgi-bin/contact.pl
You're quite right, have revised it to look like...
if ($Record =~ /^(abc|def|ghi)\d{5}\.$/)
Regards.
------------------------------
Date: Sat, 29 Jan 2005 14:04:02 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: regular expression question
Message-Id: <361g1dF4pohklU1@individual.net>
Atlantis wrote:
> Gunnar Hjalmarsson wrote:
>>Atlantis wrote:
>>>
>>> if ($Record =~ /\s*(abc|def|ghi)\d{5}\.{1}\s*/)
>>> # Checks for leading and trailing white spaces.
>>
>>In what way does the regex check for leading and trailing white spaces?
>>Which strings would it match that are not matched by:
>>
>> /(abc|def|ghi)\d{5}\./
>>
>>(or vice versa) ??
>
> You're quite right, have revised it to look like...
>
> if ($Record =~ /^(abc|def|ghi)\d{5}\.$/)
That does not do what the OP asked for.
"I am trying to test a string to see if it begins with a combinations of
possible 3 letter words plus exactly 5 digits and a . (leading spaces
are ok)"
This does:
/^\s*(abc|def|ghi)\d{5}\./
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: Sat, 29 Jan 2005 14:46:11 GMT
From: "Atlantis" <noeltd@hotmail.com>
Subject: Re: regular expression question
Message-Id: <TkNKd.200$A01.187@newsfe2-win.ntli.net>
"Gunnar Hjalmarsson" <noreply@gunnar.cc> wrote in message
news:361g1dF4pohklU1@individual.net...
> Atlantis wrote:
> > Gunnar Hjalmarsson wrote:
> >>Atlantis wrote:
> >>>
> >>> if ($Record =~ /\s*(abc|def|ghi)\d{5}\.{1}\s*/)
> >>> # Checks for leading and trailing white spaces.
> >>
> >>In what way does the regex check for leading and trailing white spaces?
> >>Which strings would it match that are not matched by:
> >>
> >> /(abc|def|ghi)\d{5}\./
> >>
> >>(or vice versa) ??
> >
> > You're quite right, have revised it to look like...
> >
> > if ($Record =~ /^(abc|def|ghi)\d{5}\.$/)
>
> That does not do what the OP asked for.
>
> "I am trying to test a string to see if it begins with a combinations of
> possible 3 letter words plus exactly 5 digits and a . (leading spaces
> are ok)"
>
> This does:
>
> /^\s*(abc|def|ghi)\d{5}\./
>
> --
> Gunnar Hjalmarsson
> Email: http://www.gunnar.cc/cgi-bin/contact.pl
Right again:$;$
------------------------------
Date: Sat, 29 Jan 2005 01:59:30 -0500
From: "kums" <bckumari@yahoo.com>
Subject: remove junk characters
Message-Id: <f83d64e97d246c76a66e886355ea7045@localhost.talkaboutprogramming.com>
hi,
I have extracted contents from tamil webpage and stored into one file.
While doing some process on this file,some extra
junk characters are stored inbetween the tamil text.
how to remove these junk characters?
------------------------------
Date: Sat, 29 Jan 2005 08:58:04 +0000
From: Brian McCauley <nobull@mail.com>
Subject: Re: remove junk characters
Message-Id: <ctfiss$3a7$1@sun3.bham.ac.uk>
kums wrote:
> I have extracted contents from tamil webpage and stored into one file.
> While doing some process on this file,some extra
> junk characters are stored inbetween the tamil text.
> how to remove these junk characters?
You would probably do better to figure out where they are comming from
and fix that. Likely there is some bad encoding system convertion going
on. What encoding is the file using? How are you opening it?
However are you sure that they are junk?
Can you post the exact sequence of Unicode code-points that you are
seeing. Maybe they are some of the more subtle Unicode entities.
If you want to remove all occurances of a specific Unicode code-point
you can do this with Perl's usual string manipulation functrions. (s///
and tr///).
------------------------------
Date: Fri, 28 Jan 2005 22:09:12 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Search Through List
Message-Id: <slrncvm338.5hg.tadmc@magna.augustmail.com>
Martin Kissner <news@chaos-net.de> wrote:
> # if ($teammate eq $_ ) # Case does matter
> if ($teammate =~ /\b$_\b/i ) # Case does not matter
if (lc $teammate eq lc $_ ) # Case does not matter
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Sat, 29 Jan 2005 10:56:08 +0100
From: Martin Kissner <news@chaos-net.de>
Subject: Re: Search Through List
Message-Id: <slrncvmndo.1rr.news@maki.homeunix.net>
Tad McClellan wrote :
> Martin Kissner <news@chaos-net.de> wrote:
>> if ($teammate =~ /\b$_\b/i ) # Case does not matter
>
> if (lc $teammate eq lc $_ ) # Case does not matter
Thank you for that hint.
I guess it is "better" because no regex evaluation is necessary to
return the same result.
Regards
Martin
--
perl -e 'print 7.74.117.115.116.11.32.13.97.110.111.116.104.101.114.11
.32.13.112.101.114.108.11.32.13.104.97.99.107.101.114.10.7'
------------------------------
Date: Sat, 29 Jan 2005 08:01:57 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Search Through List
Message-Id: <slrncvn5ql.6vb.tadmc@magna.augustmail.com>
Martin Kissner <news@chaos-net.de> wrote:
> Tad McClellan wrote :
>> Martin Kissner <news@chaos-net.de> wrote:
>>> if ($teammate =~ /\b$_\b/i ) # Case does not matter
I forgot to mention it earlier, but your pattern was not correct,
it should be using ^ and $ anchors instead of \b anchors.
>> if (lc $teammate eq lc $_ ) # Case does not matter
>
> Thank you for that hint.
> I guess it is "better" because no regex evaluation is necessary to
> return the same result.
Right, kinda.
The primary reason it is better IMO is because it *looks like*
an equality test.
$teammate =~ /^$_$/i vs. lc $teammate eq lc $_
You have to think about the first one for a second to realize
that it is an equality test in disguise.
I eschew disguising production code. :-)
A secondary reason is we don't have to concern ourselves with
regex metacharacters that might be in $_.
Saving CPU cycles would be a last reason, as should many
performance optimizations.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Sat, 29 Jan 2005 02:23:00 GMT
From: Larry <dontmewithme@got.it>
Subject: Re: Starting Point for backup script
Message-Id: <dontmewithme-4F378F.03223729012005@twister1.tin.it>
In article <Xns95EC64BE85436asu1cornelledu@127.0.0.1>,
"A. Sinan Unur" <1usa@llenroc.ude.invalid> wrote:
> When posting, please provide some context so everyone else knows what you
> are talking about.
you're right, although you can't tell the difference between X or
Classic, no offence.
------------------------------
Date: Sat, 29 Jan 2005 12:26:17 GMT
From: Bart Lateur <bart.lateur@pandora.be>
Subject: Re: Starting Point for backup script
Message-Id: <650nv0dfalbhms4qi018jk1am19jkvifm3@4ax.com>
A. Sinan Unur wrote:
>Me, I have never warmed up to
>Macs, ever since I found out that I had to drag the floppy icon to the
>trash to be able to get it out of the drive.
Yes, that's about the most stupid UI trick Apple ever introduced. I
never use it, my intuition tells me it might be changed to wipe the disk
some day.
I always use the cmd-Y key combination.
--
Bart.
------------------------------
Date: 29 Jan 2005 06:57:11 +0100
From: Gabriel Dos Reis <gdr@integrable-solutions.net>
Subject: Re: what's OOP's jargons and complexities?
Message-Id: <m3wttwn5fs.fsf@uniton.integrable-solutions.net>
Martin Ambuhl <mambuhl@earthlink.net> writes:
| Dan Perl wrote:
|
| > Actually, it can be as simple as:
| > public class test {
|
| There is no "public" or "class" in C. Please don't post such trash to
| comp.lang.c. In fact, C++ is not topical in any of the five
But, it was anything but C++. Maybe Java.
--
Gabriel Dos Reis
gdr@integrable-solutions.net
------------------------------
Date: Sat, 29 Jan 2005 08:34:30 +0100
From: jacob navia <jacob@jacob.remcomp.fr>
Subject: Re: what's OOP's jargons and complexities?
Message-Id: <41fb3c85$0$10470$8fcfb975@news.wanadoo.fr>
Good post.
First article that demistifies this OO centered approach
in quite a long time.
This approach has its strength, but also has it weakness,
it is not the solution for every problem appearing in
data processing.
------------------------------
Date: Sat, 29 Jan 2005 02:42:38 -0500
From: Martin Ambuhl <mambuhl@earthlink.net>
Subject: Re: what's OOP's jargons and complexities?
Message-Id: <360t3iF4rjc9vU1@individual.net>
Gabriel Dos Reis wrote:
> Martin Ambuhl <mambuhl@earthlink.net> writes:
>
> | Dan Perl wrote:
> |
> | > Actually, it can be as simple as:
> | > public class test {
> |
> | There is no "public" or "class" in C. Please don't post such trash to
> | comp.lang.c. In fact, C++ is not topical in any of the five
>
> But, it was anything but C++. Maybe Java.
>
And why is Java topical for any of the five newsgroups he spewed on,
which deal with perl, python, lisp, scheme, and C? There must be a high
correlation between using Java and idiocy.
------------------------------
Date: Sat, 29 Jan 2005 08:31:14 GMT
From: Keith Thompson <kst-u@mib.org>
Subject: Re: what's OOP's jargons and complexities?
Message-Id: <lnllacocvk.fsf@nuthaus.mib.org>
jacob navia <jacob@jacob.remcomp.fr> writes:
> Good post.
>
> First article that demistifies this OO centered approach
> in quite a long time.
I have no idea whether it was "good" or not, but it was blatantly
off-topic in at least comp.lang.c, and probably all the other
newsgroups to which it was cross-posted. Jacob, please don't
encourage this kind of newsgroup abuse.
--
Keith Thompson (The_Other_Keith) kst-u@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
------------------------------
Date: Sat, 29 Jan 2005 11:26:07 GMT
From: CBFalconer <cbfalconer@yahoo.com>
Subject: Re: what's OOP's jargons and complexities?
Message-Id: <41FB648B.66BA1AB9@yahoo.com>
jacob navia wrote:
>
> Good post.
>
> First article that demistifies this OO centered approach
> in quite a long time.
>
> This approach has its strength, but also has it weakness,
> it is not the solution for every problem appearing in
> data processing.
Xah Lee is a known troll, who likes to crosspost to many OT groups
and stir up the ants. F'ups set.
--
"If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers." - Keith Thompson
------------------------------
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 7708
***************************************