[25721] in Perl-Users-Digest
Perl-Users Digest, Issue: 7961 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Apr 11 03:05:34 2005
Date: Mon, 11 Apr 2005 00:05: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 Mon, 11 Apr 2005 Volume: 10 Number: 7961
Today's topics:
Re: GOD IS DEAD, THE GREATEST NEWS EVER! <killgod@killgod.com>
Re: if(wantarray){...}else{...} <burlo.stumproot@gmail.com>
Re: if(wantarray){...}else{...} <tadmc@augustmail.com>
Re: if(wantarray){...}else{...} axel@white-eagle.invalid.uk
Re: if(wantarray){...}else{...} <1usa@llenroc.ude.invalid>
IIS calling cscript.exe from cgi permission denied - WM <JM@jm.biz>
Insert Text on line after regex match wbell@csxinc.com
Re: Insert Text on line after regex match (Greg Bacon)
Re: Insert Text on line after regex match wbell@csxinc.com
Re: newbie baffled by de/referencing with subroutines <1usa@llenroc.ude.invalid>
Re: newbie baffled by de/referencing with subroutines <tadmc@augustmail.com>
Re: newbie baffled by de/referencing with subroutines <tadmc@augustmail.com>
Re: Not able to connect to oracle db using DBI ( Active debhatta@hotmail.com
Re: Perl executable showing html in default browser <joe@inwap.com>
Re: Perl style array in C? <joe@inwap.com>
UTF-8 in regexp with 5.8.1 <groleau+news@freeshell.org>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sun, 10 Apr 2005 22:58:10 GMT
From: "SheBlewHimDidYouBlowHim" <killgod@killgod.com>
Subject: Re: GOD IS DEAD, THE GREATEST NEWS EVER!
Message-Id: <6ci6e.3642$go4.3637@newsread2.news.atl.earthlink.net>
yea, god is dead, all religion is banned, the greatest news ever !!!!!
<RonGrossi_38211@yahoo.com> wrote in message
news:1113169633.458752.141730@z14g2000cwz.googlegroups.com...
The Greatest News Ever! click link
http://groups-beta.google.com/group/alt.politics.bush/browse_thread/thread/9b420fd9fc320e49/0215b46e845a8553#0215b46e845a8553
·._._.·º°`°º·._._.·º°`°º·._._.·º°`°º·._._.·º°`°º·._._.·º°`°º·._._.··._._.·º°`°º·._._.·º°`°º·._._.·º°`°º·._._.·º°`°º·._._.·º°`°º·._._.··._._.·º°`°º·._._.·º°`°º·._._.·º°`°º·._._.·º°`°º·._._.·º°`°º·._._.··._._.·º°`°º·._._.·º°`°º·._._.·º°`°º·._._.·º°`°º·._._.·º°`°º·._._.··._._.·º°`°º·._._.·º°`°º·._._.·º°`°º·._._.·º°`°º·._._.·º°`°º·._._.··._._.·º°`°º·._._.·º°`°º·._._.·º°`°º·._._.·º°`°º·._._.·º°`°º·._._.··._._.·º°`°º·._._.·º°`°º·._._.·º°`°º·._._.·º°`°º·._._.·º°`°º·._._.··._._.·º°`°º·._._.·º°`°º·._._.·º°`°º·._._.·º°`°º·._._.·º°`°º·._._.··._._.·º°`°º·._._.·º°`°º·._._.·º°`°º·._._.·º°`°º·._._.·º°`°º·._._.··._._.·º°`°º·._._.·º°`°º·._._.·º°`°º·._._.·º°`°º·._._.·º°`°º·._._.·
The reason some people don't know for sure
if they are going to Heaven when they die
is because they just don't know.
The good news is that you can know for
sure that you are going to Heaven which is
described in the Holy Bible as a beautiful
place with no death, sorrow, sickness or
pain.
God tells us in the Holy Bible how simple
it is to be saved so that we can live
forever with Him in Heaven.
"For if you confess with your mouth Jesus
is Lord and believe in your heart that God
raised Him from the dead, you
WILL BE SAVED." (Romans 10:9)
Over 2000 years ago God came from Heaven
to earth in the person of Jesus Christ to
shed His blood and die on a cross to pay
our sin debt in full.
Jesus Christ was born in Israel
supernaturally to a virgin Jewish woman
named Mary and lived a sinless life for
thirty-three years.
At the age of thirty-three Jesus was
scourged and had a crown of thorns pressed
onto His head then Jesus was crucified.
Three days after Jesus died on a cross and
was placed in a grave Jesus rose from the
dead as Jesus said would happen before
Jesus died.
If someone tells you that they are going
to die and in three days come back to life
again and it happens then this person must
be the real deal.
Jesus Christ is the only person that ever
lived a perfect sinless life.
This is why Jesus is able to cover our
sins(misdeeds) with His own blood because
Jesus is sinless.
The Holy Bible says, "In Him(Jesus) we
have redemption through His blood, the
forgiveness of sins..." (Ephesians 1:7)
If you would like God to forgive you of
your past, present and future sins just
ask Jesus Christ to be your Lord and
Saviour.
It doesn't matter how old you are or how
many bad things that you have done in
your life including lying and stealing
all the way up to murder.
Just pray the prayer below with your
mouth and mean it from your heart and
God will hear you and save you.
Dear Jesus Christ, I want to be saved so
that I can have a home in Heaven with You
when I die. I agree with You that I am a
sinner. I believe that You love me and want
to save me. I believe that You bled and
died on the cross to pay the penalty for my
sins and that You rose from the dead.
Please forgive my sins and come into my
heart and be my Lord and Saviour. Thanks
Lord Jesus Christ for forgiving me and
saving me through Your merciful grace.
Amen.
Welcome to the family of God if you just
allowed God to save you. Now you are a real
Christian and you can know for sure that
you will live in Heaven forever when this
life comes to an end.
As a child of God we are to avoid
sin(wrong doing), but if you do sin the
Holy Bible says, "My dear children, I
write this to you so that you will not sin.
But if anybody does sin, we have one who
speaks to the Father in our defense Jesus
Christ, the Righteous One."
Those of you that have not yet decided to
place your trust in the Lord Jesus Christ
may never get another chance to do so
because you do not know when you will die.
This means that if you die without
trusting in Jesus Christ as your Lord and
Saviour you will be forever separated from
the love of God in a place called Hell.
The Holy Bible descibes Hell as a place of
eternal torment, suffering, pain and agony
for all those who have rejected Jesus Christ.
The good news is that you can avoid Hell by
allowing Jesus Christ to save you today.
Only then will you have true peace in your
life knowing that no matter what happens you
are on your way to Heaven.
Servant of the Lord Jesus Christ,
Internet Evangelist
Ronald L. Grossi
____________________________________________________
Got Questions?
http://www.gotquestions.org/archive.html
Other Languages
http://www.godssimpleplan.org/gsps.html
Free Movie: To Hell and Back
http://www.tbn.org/index.php/8/1.html
Animation
http://www.gieson.com/Library/projects/animations/walk/index.html
The Passion Of The Christ
http://www.thepassionofthechrist.com
Beware Of Cults
http://www.carm.org/cults/cultlist.htm
About Hell
http://www.equip.org/free/DH198.htm
Is Jesus God?
http://www.powertochange.com/questions/qna2.html
Free Online Bible
http://www.bibledatabase.net
------------------------------
Date: 10 Apr 2005 15:29:41 -0700
From: "Stumproot" <burlo.stumproot@gmail.com>
Subject: Re: if(wantarray){...}else{...}
Message-Id: <1113172181.424078.302170@o13g2000cwo.googlegroups.com>
A. Sinan Unur wrote:
> "Stumproot" <burlo.stumproot@gmail.com> wrote in
> news:1113167548.426110.231150@o13g2000cwo.googlegroups.com:
>
> > Posted from/using google news.
>
> Why is that relevant?
To explain any weird formatting of the code or replies.
> > I have "return" snippets like this in several funktions
> > and I'm getting tired of writing them.
>
> OK.
>
> > Is there a better way?
>
> I am not sure because I don't really understand what problem you are
> attempting to solve.
I want to type less, and produce clearer code.
> > # Start return snippet
> > if(wantarray) {
> > my @res = A_Funktion($a1,$a2);
> > return @res;
> > } else {
> > return A_Funktion($a1,$a2);
> > }
>
> Does A_Funktion behave differenly in scalar versus array context? If
> it does not, then you shouldn't worry about wantarray.
Yes it does, in scalar context it returns an object, in list context a
list representation of the object.
What I'm doing is wrapping a bunch of functions that work on lists in
an object. And I found myself writing alot of the above lines when I
wrote the object manipulation functions.
(A side note. After thinking about it I may remove the wantarray part
alltogether because using the list representation should very rarly be
nessesary and can be extracted when needed.)
But for future use I'll remember this snippet, using scalar on a
function never occured to me even though I know it works.
> wantarray ? A_Funktion(@_) : scalar A_Funktion(@_);
Thanks.
------------------------------
Date: Sun, 10 Apr 2005 17:49:32 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: if(wantarray){...}else{...}
Message-Id: <slrnd5jbbs.n2s.tadmc@magna.augustmail.com>
Stumproot <burlo.stumproot@gmail.com> wrote:
> Posted from/using google news.
What is the relevance of including that?
> I have "return" snippets like this in several funktions
> and I'm getting tired of writing them.
>
> Is there a better way?
Is there a better way to what?
> sub fun1 {
> .
> .
> .
> lots going on
> .
> .
>
> # Start return snippet
> if(wantarray) {
> my @res = A_Funktion($a1,$a2);
> return @res;
> } else {
> return A_Funktion($a1,$a2);
> }
> # End return snippet
> }
I have no idea why are you doing this.
If A_Funktion() is written to be used in either context, then
the wantarray() checking would be inside of A_Funktion()'s
declaration rather than wrapped around every call to A_Funktion().
No wonder you're getting tired. :-)
Context is "see through". In the code below, A_Funktion() sees
whatever context fun1() got called in.
-----------------------------
#!/usr/bin/perl
use warnings;
use strict;
my $scalar = fun1();
my($list) = fun1();
my($a1,$a2);
sub fun1 {
# lots going on...
return A_Funktion($a1,$a2);
}
sub A_Funktion {
if(wantarray) {
warn "A_Funktion() in list context\n"
} else {
warn "A_Funktion() in scalar context\n"
}
}
-----------------------------
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Sun, 10 Apr 2005 20:16:19 -0500
From: axel@white-eagle.invalid.uk
Subject: Re: if(wantarray){...}else{...}
Message-Id: <c_ydnbmNR65-UsTfRVn-qA@adelphia.com>
A. Sinan Unur <1usa@llenroc.ude.invalid> wrote:
> "Stumproot" <burlo.stumproot@gmail.com> wrote in
>> I have "return" snippets like this in several funktions
>> and I'm getting tired of writing them.
>> Is there a better way?
> I am not sure because I don't really understand what problem you are
> attempting to solve.
>> # Start return snippet
>> if(wantarray) {
>> my @res = A_Funktion($a1,$a2);
>> return @res;
>> } else {
>> return A_Funktion($a1,$a2);
>> }
> Does A_Funktion behave differenly in scalar versus array context? If it
> does not, then you shouldn't worry about wantarray.
Is there any need to worry about this - if the whatever A_Funktion
returns is itself to be immediately returned there should be no
need for the intermediate function to ascertain the context.
> On the other hand, is the following more like the situation above?
> #! /usr/bin/perl
>
> my $r = A_Funktion(qw(Hello Goodbye));
> my @r = A_Funktion(qw(Hello Goodbye));
>
> print "$r\n@r\n";
>
> sub A_Funktion_Caller {
> wantarray ? A_Funktion(@_) : scalar A_Funktion(@_);
> }
So the following would have the same effect:
sub A_Funktion_Caller {
A_Funktion(@_);
}
> sub A_Funktion {
> my ($x, $y) = @_;
> my $r = "$x and $y";
> wantarray ? $r : length $r;
> }
>
> __END__
Axel
------------------------------
Date: Mon, 11 Apr 2005 02:34:41 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: if(wantarray){...}else{...}
Message-Id: <Xns9634E59C29A6Casu1cornelledu@127.0.0.1>
axel@white-eagle.invalid.uk wrote in news:c_ydnbmNR65-UsTfRVn-
qA@adelphia.com:
> A. Sinan Unur <1usa@llenroc.ude.invalid> wrote:
>> sub A_Funktion_Caller {
>> wantarray ? A_Funktion(@_) : scalar A_Funktion(@_);
>> }
>
> So the following would have the same effect:
>
> sub A_Funktion_Caller {
> A_Funktion(@_);
> }
In this case, yes. But it might be that A_Funktion_caller needs to do
something with the return value of A_Funktion, and what it needs to do
might depend on context. Dunno. I just tried to reduce the setup to bare
essentials.
Sinan
--
A. Sinan Unur <1usa@llenroc.ude.invalid>
(reverse each component and remove .invalid for email address)
comp.lang.perl.misc guidelines on the WWW:
http://mail.augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html
------------------------------
Date: Mon, 11 Apr 2005 04:12:52 GMT
From: "J M" <JM@jm.biz>
Subject: IIS calling cscript.exe from cgi permission denied - WMI access
Message-Id: <8Pm6e.448$zq4.169@newssvr11.news.prodigy.com>
I have a perl cgi script on Windows 2003 server with IIS 6.0 that is calling
prnport.vbs, prnmgr.vbs (supplied by microsoft that creates printer port and
print queue on server) however IIS returns "cscript ... permission denied"
error even after adding IUSR_<SERVER> user id to administrator list. It
appears that error code indicates that WMI root object is not accessable by
IUSR account. Any suggestions?
I am simply calling vbs script using back tick in perl `<PATH>:\\cscript
<PATH>:\\prnport.vbs options`
Thanks!
------------------------------
Date: 10 Apr 2005 19:01:19 -0700
From: wbell@csxinc.com
Subject: Insert Text on line after regex match
Message-Id: <1113184879.685849.325300@o13g2000cwo.googlegroups.com>
Basically i am trying to enter some lines into an httpd.conf directly
after a certain matched text.
ex.
I want to insert this
AddType application/x-httpd-php .php .phtml
after this
AddHandler cgi-script .cgi
and no where else.
I have tried some while loops with if then matching, but i cant seem to
get it right. Any help would be much appreciated.
------------------------------
Date: Mon, 11 Apr 2005 02:36:01 -0000
From: gbacon@hiwaay.net (Greg Bacon)
Subject: Re: Insert Text on line after regex match
Message-Id: <115jokhksv1429@corp.supernews.com>
In article <1113184879.685849.325300@o13g2000cwo.googlegroups.com>,
<wbell@csxinc.com> wrote:
: Basically i am trying to enter some lines into an httpd.conf directly
: after a certain matched text.
:
: ex.
:
: I want to insert this
:
: AddType application/x-httpd-php .php .phtml
:
: after this
:
: AddHandler cgi-script .cgi
:
: and no where else.
:
: I have tried some while loops with if then matching, but i cant seem to
: get it right. Any help would be much appreciated.
$ cat try
#! /usr/local/bin/perl -i.bak
use warnings;
use strict;
while (<>) {
print;
print "AddType application/x-httpd-php .php .phtml\n"
if /^\s*AddHandler\s+cgi-script\s+.cgi\s*$/
}
$ cat httpd.conf
Every good boy does fine
The great mass of men lead lives of quiet desperation.
AddHandler cgi-script .cgi
foo bar baz quux uushnu
$ ./try httpd.conf
$ diff -u httpd.conf.bak httpd.conf
--- httpd.conf.bak 2005-04-10 21:31:21.113507200 -0500
+++ httpd.conf 2005-04-10 21:33:51.800184000 -0500
@@ -1,4 +1,5 @@
Every good boy does fine
The great mass of men lead lives of quiet desperation.
AddHandler cgi-script .cgi
+AddType application/x-httpd-php .php .phtml
foo bar baz quux uushnu
$
Hope this helps,
Greg
--
All the marvelous achievements of Western civilization are fruits grown
on the tree of liberty.
-- Ludwig von Mises, *The Theory of Money and Credit*
------------------------------
Date: 10 Apr 2005 20:16:35 -0700
From: wbell@csxinc.com
Subject: Re: Insert Text on line after regex match
Message-Id: <1113189395.547659.226810@g14g2000cwa.googlegroups.com>
You have helped me more than you know Greg...Thank you a million!
William
------------------------------
Date: Sun, 10 Apr 2005 22:17:08 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: newbie baffled by de/referencing with subroutines
Message-Id: <Xns9634B9F0F99F7asu1cornelledu@127.0.0.1>
"Jessica" <konradj@mindspring.com> wrote in
news:1113170027.017229.15810@g14g2000cwa.googlegroups.com:
> Thanks for your reply, Sinan. You're right, I haven't checked the
> posting guidelines (abject apologies from this thoroughly befuddled
> newbie). Also I did not use warnings or strict, as that's not what
> our instructor has us do, for better or worse.
For worse. Do read the guidelines for the justification for using them.
Then, demand that your instructor use them. If not, either ask him/her
to explain why. If the explanation does not satisfy you, demand your
money back. :) I know this sounds a little over the top, but I can see
no reason why warnings and strict should be turned off when learning.
> As far as sample code, here's a sketch. The actual code that
> generates @uniqueParsed is long and probably irrelevant, so I'll kinda
> skip over it:
>
> sub parseGff
> {
> do lots of stuff ...
> my @uniqueParsed = ();
> put stuff into @uniqueParsed ...
> my $uniqueParsed_r = \@uniqueParsed;
> some more stuff that doesn't matter here ...
> }
>
> parseGff
>
> print "dereferenced array is @{$uniqueParsed_r} \n";
>
>
> So you're right, I don't return anything - and that's the part that
> has me baffled. How do I return a reference from the sub?
OK, I get the picture now.
Here is a short example to get you started:
#! /usr/bin/perl
my $array_ref = select_letters();
print "@$array_ref\n";
sub select_letters {
my @letters;
for my $letter ( 'A' .. 'Z' ) {
if(rand(1) < 0.5) {
push @letters, $letter;
}
}
return \@letters;
}
__END__
> (I have zero background in programming, it's only the 5th lecture
> and we're doing references - the instructor is going too fast for
> newbies like me.)
Perl comes with extensive documentation.
Depending on your platform, you can access this documentation in a
variety of ways.
On Windows, with ActiveState Perl, you can find documentation in HTML
format via the Start menu.
On all platforms, you can use the command line program perldoc to view
documentation. You might want to consult:
perldoc perlreftut
and
perldoc perlsub
Sinan
--
A. Sinan Unur <1usa@llenroc.ude.invalid>
(reverse each component and remove .invalid for email address)
comp.lang.perl.misc guidelines on the WWW:
http://mail.augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html
------------------------------
Date: Sun, 10 Apr 2005 17:59:44 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: newbie baffled by de/referencing with subroutines
Message-Id: <slrnd5jbv0.n2s.tadmc@magna.augustmail.com>
Jessica <konradj@mindspring.com> wrote:
> I created an elaborate array (my @uniqueParsed) inside a subroutine
> and I want to use data from that array after the sub is finished. I
> declared a reference inside the sub:
>
> my $uniqueParsed_r = \@uniqueParsed;
>
> then tried to print the data outside the sub by this dereference:
>
> print "dereferenced array is @$uniqueParsed_r \n";
>
> but nothing was returned (i.e., @$uniqueParsed_r is empty). By the
> way, if I put the print statement inside the sub, the dereferenced
> array prints correctly.
You should always enable strict and warnings when developing Perl code!
> What's wrong with my reference and/or dereference,
There is nothing wrong with either your reference nor your dereference.
There is something wrong with your variable scoping.
(I am forced to guess that that is what it is, because you did
not include a short and complete program that I can run. Have
you seen the Posting Guidelines that are posted here frequently?
)
> and how do I fix it?
Don't declare a lexical variable that will cease to exist as
soon as the subroutine returns, instead return a reference
to the elaborate array.
sub nameless_sub {
my @uniqueParsed;
# populate the array...
return \@uniqueParsed;
}
my $uP = nameless_sub();
print "dereferenced array is @$uP\n";
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Sun, 10 Apr 2005 23:24:25 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: newbie baffled by de/referencing with subroutines
Message-Id: <slrnd5juvp.1o9.tadmc@magna.augustmail.com>
Jessica <konradj@mindspring.com> wrote:
> Also I did not use warnings or strict, as that's not what our
> instructor has us do, for better or worse.
You have a poor instructor.
strict and warnings help find bugs in your code, take all
of the help that you can get.
> How do I return a reference from the sub?
return \@uniqueParsed;
> it's only the 5th lecture and we're doing
> references -
You have a poorly designed curriculum.
> the instructor is going too fast for newbies like me.)
You have a poor instructor.
Sounds all-around poor. How much was the tuition?
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: 10 Apr 2005 21:43:03 -0700
From: debhatta@hotmail.com
Subject: Re: Not able to connect to oracle db using DBI ( Activestate )
Message-Id: <1113194583.835670.96480@z14g2000cwz.googlegroups.com>
DBD-Oracle
Unfortunately, Oracle no longer provides the Oracle client libraries
for free. ActiveState was also explicitly forbidden by Oracle from
distributing PPMs that dynamically link with client libraries users may
already possess. Therefore, we can no longer provide a PPM for
DBD-Oracle. The DBD-Oracle package for the PPM included with ActivePerl
5.6 is still available in the ActiveState PPM repository; it is the
last package we compiled before the licensing changed.
If you wish to compile this module locally, the source may be obtained
from http://www.cpan.org. For instructions on using CPAN, see
http://aspn.activestate.com/ASPN/Reference/Products/ActivePerl/lib/CPAN.html.
If you are using Windows, an easy workaround might be to use DBD-ODBC
instead
------------------------------
Date: Sun, 10 Apr 2005 23:36:23 -0700
From: Joe Smith <joe@inwap.com>
Subject: Re: Perl executable showing html in default browser
Message-Id: <7oGdnTDe68F6h8ffRVn-3Q@comcast.com>
Merijn Boom wrote:
> I would like to know is somebody has experience in showing HTML from
a perl
HTML is just text. A perl program can simply use print() statements
to send HTML out whenever it is invoked.
> perl executable in the default browser
The server does not cause a brower to run.
The browser is started first, then it contacts the server.
> and let that html interact with the perl executable via the browser.
You can't do that with plain HTML.
You could do something like that by sending JavaScript or VBScript,
but not quite. For the most part, the HTTP transaction from
browser to server is already over by the time the server starts
sending a response. Further interaction usually requires initiating
a new connection to the server, which, even if using the same CGI
as before, would be a different process on the server.
> This is because we would like to convert some of our perl scripts
(ActiveState) via the Active state compiler in order to have some stand
alone executables.
Non-sequiter. A fully functional perl script can be compiled,
but compiling it does not make it more interactive than before.
-Joe
------------------------------
Date: Sun, 10 Apr 2005 23:24:43 -0700
From: Joe Smith <joe@inwap.com>
Subject: Re: Perl style array in C?
Message-Id: <apKdnX07dMethcffRVn-vA@comcast.com>
Robert Oschler wrote:
> I need some open source "C" code that will give me the same
> functionality of a Perl Style associative array:
>
> someArray["a_key_label"] = 6;
>
> I know I can't get the same syntactic sugar as Perl offers, with the usage
> of a string as the array key surrounded by square brackets.
I hope you are aware that perl does not use square brackets for
associative arrays. Hashes use curly braces.
Perl evaluates
$someArray["a_key_label"] = 6;
as
$someArray[0] = 6;
since "a_key_label" is non-numeric.
-Joe
------------------------------
Date: Sun, 10 Apr 2005 19:22:45 -0500
From: Wes Groleau <groleau+news@freeshell.org>
Subject: UTF-8 in regexp with 5.8.1
Message-Id: <d3cfv7$8a4$1@domitilla.aioe.org>
I have a file containing thousands of Spanish words, encoded AFAIK)
in UTF-8. I also have a perl script in UTF-8, which says (hope
pasting works):
#!/usr/bin/perl -w -CSD
#
# NOTE: The extra space in the bang line is mandatory (bug in perl 5.8)
use warnings;
use strict;
use utf8;
while (<>)
{
print if ( /ñ/ )
}
What is in the regexp is supposed to be "small n with tilde"
and I verified with od -xc that it is hex C3 B1 as is every
place in the file where that letter appears.
The script is intended to find all words containing that
letter. But it finds nothing. After wading through gallons
of text (man encoding, man utf8, man perlunicode, etc.),
I still had no reason to think it was wrong. But I added
use encoding "utf8";
and ran it again, getting only:
Ze-Admins-Computer:~/Desktop wgroleau$ char-find palabras.utf8
Malformed UTF-8 character (unexpected non-continuation byte 0x00,
immediately after start byte 0xde) at
/Volumes/Parents/wgroleau/bin/char-find line 12.
?!? According to 'od -xc' the script does NOT contain any
byte that is 0xde In fact, the ONLY bytes in the script that
are not ASCII are the bytes for the "enye" which are on line
twelve, but neither of them is a DE and NO bytes are 00.
Have I found a bug in perl or is my ignorance just getting
the best of me?
Oh, yeah, I also tried a few things with 'binmode' that didn't
work either.
WWG
------------------------------
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 7961
***************************************