[28003] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 9367 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Jun 24 11:05:59 2006

Date: Sat, 24 Jun 2006 08: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           Sat, 24 Jun 2006     Volume: 10 Number: 9367

Today's topics:
    Re: Hash of Arrays <hjp-usenet2@hjp.at>
    Re: Native language versions <hjp-usenet2@hjp.at>
        new CPAN modules on Sat Jun 24 2006 (Randal Schwartz)
        nl_langinfo - problem <adamsmith@econ.com>
    Re: Online Graphing Calculator - Perl Backend <corff@zedat.fu-berlin.de>
        Python and cellular automata (It works this time!) <defcon8@gmail.com>
    Re: Python and cellular automata (It works this time!) <Bulkan@gmail.com>
    Re: Python and cellular automata (It works this time!) <defcon8@gmail.com>
        Regexp problem <dont@like.spammers>
    Re: Regexp problem <jurgenex@hotmail.com>
    Re: Script debugging  - NOPE !!! Installation Failure?? <adamsmith@econ.com>
    Re: Script debugging  <benmorrow@tiscali.co.uk>
    Re: Script debugging  <adamsmith@econ.com>
    Re: Script debugging  <adamsmith@econ.com>
    Re: Unwanted character "^@" in perl output <hjp-usenet2@hjp.at>
    Re: use binary operator on ascii text string <hjp-usenet2@hjp.at>
    Re: use binary operator on ascii text string <jurgenex@hotmail.com>
    Re: use binary operator on ascii text string <hjp-usenet2@hjp.at>
    Re: use binary operator on ascii text string <David.Squire@no.spam.from.here.au>
    Re: What is Expressiveness in a Computer Language <david.nospam.hopwood@blueyonder.co.uk>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Sat, 24 Jun 2006 15:19:59 +0200
From: "Peter J. Holzer" <hjp-usenet2@hjp.at>
Subject: Re: Hash of Arrays
Message-Id: <v5ej7e.bqi.ln@teal.hjp.at>

Tad McClellan wrote:
> John W. Krahn <someone@example.com> wrote:
>> Deepu wrote:
>>> %hash = (
>>>                  FILE1 => ["STATEMAIN", "STATESUSPEND", "STATE1",
>>> "STATE2", "STATERESUME", "RESET"],
>>>                  FILE1 => ["STATEMAIN", "STATE9", "STATE10"],
>> 
>> In Perl a hash cannot have two different keys with the same name.
> 
> 
> Can a hash have two different keys with the same name somewhere
> besides in Perl?

Depends on what you mean by "hash". A hash table can, since it needs to
handle hash collisions, too. An associative array cannot, since it uses
the key as a unique index.

> How do you distinguish between the two?

Several possibilities: E.g., address or key plus serial number.

> How does the hashing differ?

It doesn't. You have several entries with the same hash value, but you
have that with unique keys, too.

> Should I take this off-topic question elsewhere?  :-)

Possibly :-)

        hp

-- 
   _  | Peter J. Holzer    | Man könnte sich [die Diskussion] auch
|_|_) | Sysadmin WSR/LUGA  | sparen, wenn man sie sich einfach sparen
| |   | hjp@hjp.at         | würde.
__/   | http://www.hjp.at/ |   -- Ralph Angenendt in dang 2006-04-15


------------------------------

Date: Sat, 24 Jun 2006 12:24:45 +0200
From: "Peter J. Holzer" <hjp-usenet2@hjp.at>
Subject: Re: Native language versions
Message-Id: <et3j7e.pih.ln@teal.hjp.at>

corff@zedat.fu-berlin.de wrote:
> Peter J. Holzer <hjp-usenet2@hjp.at> wrote:
> : > Is it still Perl?
> 
> : No. Definitely not. It is a different language which can be translated
> : into perl and can use Perl modules.
> 
> Well, I am not at all against writing modules which can replace (or enrich)
> "native" Perl commands, statements and structures with English names by
> any other given language. A bit further into the still dawning age of Unicode,
> and everything can be expressed with non-ASCII characters. Not that Perl
> is the restricting factor, but the constraints are usually in the users'
> platforms.
> 
> I still have my doubts that it will help to lead people back to the joy
> of programming even a simple script. You cited the age of CLIs and built-
> in Basic, command shells etc. This age will not really return to the average
> computer user any more.

And that's a good thing. I'm not pining for the "good old days". But I
think that current GUIs (which haven't changed all that much since XEROX
invented the mouse in the 1970s) aren't optimal either. I see all the
time people doing repetitive tasks, for which on Linux I would write a
five line shell script and be done with it. And I ask myself how the GUI
user could be enabled to write that script. Or let's formulate this in a
more general way: How can the user tell the computer: "I'm doing that
stuff every week. Do it for me!"? The "language" doesn't even have to be
written, it might be graphical, or a mixture. I agree that I'm getting
away quite a bit from the OP's notion of just translating perl keywords
:-).


> Computers tend to become more and more taken for granted, omnipresent
> and powerful, to a degree that they start vanishing from public
> perception, just like electry which is delivered from wall outlets,
> not power plants, etc. Who still realizes that a digital camera, a
> mobile phone, the cash register at the local market or the ignition
> control system of your car happen to be powerful computers with
> specialized purposes and interfaces?

I'd like to have perl (or any other sane scripting language) installed
on my Nokia Communicator.

There's probably not much use for a user-accessible programming language
on a cash register. The cashier isn't supposed to reprogram the register -
the presence of such a language would probably be considered a security
risk. Neither do I see the need on a camera or a washing machine (but a
network-accessible command/status interface would be useful for both). A
modern mobile phone OTOH is almost a general purpose computer. There are
a few things for which it is unsuitable due to its small size, but apart
from that there isn't much difference to a desktop PC (and it's
certainly more powerful than the first computers I used were).


> That leads me back to Perl. The true hurdle lies not in the choice of
> English of French or Japanese words for things like "print" or "while".
> These can be replaced easily. Judging by an overwhelming number of postings,
> we see fundamental conceptual errors as the source of various posters'
> problems.

Right. Actually, it goes deeper. Some people have problems with the
concept of a loop, or a variable. These people will probably never be
able to write a program of any complexity, but even those can compose a
linear list of "things to be done". Another reason why I see the value
of translating programming languages more in embedded languages than in
general purpose programming languages. A program without variables or
loops seems strange to us. But it may replace 20 mouse clicks and
filling in of 3 text fields with a single click, so it is useful for the
user.


> This is why I question the practicality of just translating the keywords
> of a language like Perl.

As I said, I wasn't talking about translating just the keywords. I
specifically mentioned Lingua::Romana::Perligata because it changes both
the words and the grammar. And I tried to steer the topic away from
general purpose programming languages to specific applications, because
there I see value in localized programming languages.


> First of all, the documentation needs a good,
> thorough and complete translation, then you still can translate keywords,
> but when you come to concepts, structures and symbols, there is not much
> to translate. You have to learn them. Is the average native English (be she
> British, American or Asian-Pacific (Australia and Hong Kong come to my mind))
> programmer statistically less error-prone and more successful as a programmer
> just because she seemingly doesn't have to learn the keywords?

That might be an interesting topic for a study. But I think it's the
wrong question. A "programmer" does program, so he has already learned
those keywords. The more interesting question is IMHO: Are there more
programmers among people who speak English than among people who don't?
And if that is the case, is it because the latter find it harder to
learn (English based) programming languages? 


> To make a long story short: Language is more than lexicon and grammar.
> Replacing the lexicon by close approximates of the lexicon is only partially
> helpful. It is the documentation which needs a careful translation first.
> 
> Perhaps after porting Perl to so many platforms, we should start porting
> the Perl documentation to more languages besides English. CPAN would gain
> a huge advantage from such an effort, as would the global Perl community.

Googling for "deutsche perl dokumentation" gives
http://www.perlmongers.de/?DeutschePerlDokumentation and
http://wiki.perl-community.de/bin/view/Perldoc/perl as the first hits,
which is a rather sad result, as both look like somebody started a
translation project and got bored with it very quickly.

I agree that for Perl translating documentation and books is a lot more
important than translating the language. A translated Perl wouldn't be
Perl anyway.

        hp

-- 
   _  | Peter J. Holzer    | Man könnte sich [die Diskussion] auch
|_|_) | Sysadmin WSR/LUGA  | sparen, wenn man sie sich einfach sparen
| |   | hjp@hjp.at         | würde.
__/   | http://www.hjp.at/ |   -- Ralph Angenendt in dang 2006-04-15


------------------------------

Date: Sat, 24 Jun 2006 04:42:06 GMT
From: merlyn@stonehenge.com (Randal Schwartz)
Subject: new CPAN modules on Sat Jun 24 2006
Message-Id: <J1CL26.u87@zorch.sf-bay.org>

The following modules have recently been added to or updated in the
Comprehensive Perl Archive Network (CPAN).  You can install them using the
instructions in the 'perlmodinstall' page included with your Perl
distribution.

App-SimpleScan-1.10
http://search.cpan.org/~mcmahon/App-SimpleScan-1.10/
simple_scan's core code
----
App-SimpleScan-1.11
http://search.cpan.org/~mcmahon/App-SimpleScan-1.11/
simple_scan's core code
----
Blog-BlogML-Reader-0.01
http://search.cpan.org/~mmathews/Blog-BlogML-Reader-0.01/
Read data from a BlogML formatted XML document.
----
CPANPLUS-0.072
http://search.cpan.org/~kane/CPANPLUS-0.072/
API & CLI access to the CPAN mirrors
----
Class-Entity-0.4
http://search.cpan.org/~pnewman/Class-Entity-0.4/
Object interface for relational databases
----
Class-Entity-0.5
http://search.cpan.org/~pnewman/Class-Entity-0.5/
Object interface for relational databases
----
Devel-PPPort-3.08_05
http://search.cpan.org/~mhx/Devel-PPPort-3.08_05/
Perl/Pollution/Portability
----
Encode-EUCJPMS-0.06
http://search.cpan.org/~naruse/Encode-EUCJPMS-0.06/
Microsoft Compatible Encodings for Japanese
----
Froody-42.008
http://search.cpan.org/~fotango/Froody-42.008/
Yet another XML web API framework
----
Froody-42.009
http://search.cpan.org/~fotango/Froody-42.009/
Yet another XML web API framework
----
JavaScript-XRay-0.99_1
http://search.cpan.org/~jbisbee/JavaScript-XRay-0.99_1/
See What JavaScript is Doing
----
JavaScript-XRay-0.99_2
http://search.cpan.org/~jbisbee/JavaScript-XRay-0.99_2/
See What JavaScript is Doing
----
JavaScript-XRay-0.99_3
http://search.cpan.org/~jbisbee/JavaScript-XRay-0.99_3/
See What JavaScript is Doing
----
JavaScript-XRay-0.99_4
http://search.cpan.org/~jbisbee/JavaScript-XRay-0.99_4/
See What JavaScript is Doing
----
Linux-Bootloader-1.1
http://search.cpan.org/~bryce/Linux-Bootloader-1.1/
Base class interacting with Linux bootloaders
----
Mac-iTunes-0.86
http://search.cpan.org/~bdfoy/Mac-iTunes-0.86/
interact with and control iTunes
----
Moose-0.09_03
http://search.cpan.org/~stevan/Moose-0.09_03/
Moose, it's the new Camel
----
Net-Flickr-Backup-2.7
http://search.cpan.org/~ascope/Net-Flickr-Backup-2.7/
OOP for backing up your Flickr photos locally
----
Net-Flickr-RDF-1.8
http://search.cpan.org/~ascope/Net-Flickr-RDF-1.8/
a.k.a RDF::Describes::Flickr
----
Net-MAC-Vendor-1.13
http://search.cpan.org/~bdfoy/Net-MAC-Vendor-1.13/
look up the vendor for a MAC
----
Net-UKDomain-Nominet-Automaton-1.00
http://search.cpan.org/~cliffordj/Net-UKDomain-Nominet-Automaton-1.00/
Module to handle the Nominet Automaton for domain registration and modification.
----
Object-InsideOut-1.43
http://search.cpan.org/~jdhedden/Object-InsideOut-1.43/
Comprehensive inside-out object support module
----
Object-InsideOut-1.44
http://search.cpan.org/~jdhedden/Object-InsideOut-1.44/
Comprehensive inside-out object support module
----
PDF-API2-Simple-1.1.0
http://search.cpan.org/~redtree/PDF-API2-Simple-1.1.0/
Simplistic wrapper for the excellent PDF::API2 modules
----
Pod-PseudoPod-LaTeX-0.10
http://search.cpan.org/~chromatic/Pod-PseudoPod-LaTeX-0.10/
convert Pod::PseudoPod documents into LaTeX
----
Rubric-Entry-Formatter-KwikiFormatish-0.551
http://search.cpan.org/~rjbs/Rubric-Entry-Formatter-KwikiFormatish-0.551/
format entries with AlmostKwikiText
----
Rubric-Entry-Formatter-Markdown-0.551
http://search.cpan.org/~rjbs/Rubric-Entry-Formatter-Markdown-0.551/
format entries with Markdown (duh!)
----
SQL-KeywordSearch-1.11
http://search.cpan.org/~markstos/SQL-KeywordSearch-1.11/
generate SQL for simple keyword searches
----
Template-1.21
http://search.cpan.org/~abalama/Template-1.21/
Templates processing module
----
TemplateM-1.21
http://search.cpan.org/~abalama/TemplateM-1.21/
Templates processing module
----
Test-MultiFork-0.5
http://search.cpan.org/~muir/Test-MultiFork-0.5/
Test suite support for multi-process programs
----
Text-NSP-0.99
http://search.cpan.org/~tpederse/Text-NSP-0.99/
The Ngram Statistic Package allows a user to count sequences of words in large corpora of text, and measure their association.
----
Text-NSP-1.01
http://search.cpan.org/~tpederse/Text-NSP-1.01/
The Ngram Statistic Package allows a user to count sequences of words in large corpora of text, and measure their association.
----
Text-Restructured-0.003_012
http://search.cpan.org/~nodine/Text-Restructured-0.003_012/
----
Text-Restructured-0.003_013
http://search.cpan.org/~nodine/Text-Restructured-0.003_013/
----
W3C-LogValidator-1.06
http://search.cpan.org/~oliviert/W3C-LogValidator-1.06/
The W3C Log Validator - Quality-focused Web Server log processing engine
----
WWW-Myspace-0.49
http://search.cpan.org/~grantg/WWW-Myspace-0.49/
Access MySpace.com profile information from Perl
----
Wx-0.50
http://search.cpan.org/~mbarbon/Wx-0.50/
interface to the wxWidgets cross-platform GUI toolkit


If you're an author of one of these modules, please submit a detailed
announcement to comp.lang.perl.announce, and we'll pass it along.

This message was generated by a Perl program described in my Linux
Magazine column, which can be found on-line (along with more than
200 other freely available past column articles) at
  http://www.stonehenge.com/merlyn/LinuxMag/col82.html

print "Just another Perl hacker," # the original

--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!


------------------------------

Date: Sat, 24 Jun 2006 07:57:01 -0700
From: Adam Smith <adamsmith@econ.com>
Subject: nl_langinfo - problem
Message-Id: <GM2dnbqLqoLbzwDZnZ2dnUVZ_tydnZ2d@speakeasy.net>

UNIX FreeBSD -V 4.9 O/S, i386 arch, Perl -V 5.8.2 Installation

I've just installed a program w/ a PERL API. Now, on launching Perl, I 
get the following error message

/usr/libexec/ld-elf.so.1: 
/usr/local/lib/perl5/5.8.2/mach/CORE/libperl.so: Undefined symbol 
"nl_langinfo"

Can't even run the debugger,

Running ==> ldd /usr/local/lib/perl5/5.8.2/mach/CORE/libperl.so
/usr/local/lib/perl5/5.8.2/mach/CORE/libperl.so:
	libm.so.2 => /root/usr/lib/libm.so.2 (0x281f8000)
	libcrypt.so.2 => /root/usr/lib/libcrypt.so.2 (0x28214000)
	libutil.so.3 => /root/usr/lib/libutil.so.3 (0x2822d000)
	libc.so.4 => /root/usr/lib/libc.so.4 (0x28072000)

Anyone with a recommendation or solution?


------------------------------

Date: 24 Jun 2006 05:22:03 GMT
From: <corff@zedat.fu-berlin.de>
Subject: Re: Online Graphing Calculator - Perl Backend
Message-Id: <4g40frF1lbo6aU3@uni-berlin.de>

robby.walker@gmail.com wrote:
: Hi - first - I fixed the negation bug although it's still not perfect -
: the precedence is a little bit off still.

Please quote meaningfully, and ...

: >
: > Is this under GPL / open source? I couldn't find the licensing info.
: > are you selling this software or services related thereto?
: > 
: > andrew

: Regarding selling, GPL, etc. - it's being released as a free service
: online but it is not being open sourced or sold.  The company I work
: at, e-Tutor (http://www.e-tutor.com), is a K-12 online school and
: tutoring program.  This is something we needed for our students and we
: wanted to share it.

please bring your posting into a sensible order (top posting fixed).
It's so cumbersome to read.

Oliver.

-- 
Dr. Oliver Corff              e-mail:    corff@zedat.fu-berlin.de


------------------------------

Date: 24 Jun 2006 07:20:59 -0700
From: "defcon8" <defcon8@gmail.com>
Subject: Python and cellular automata (It works this time!)
Message-Id: <1151158859.422817.239810@y41g2000cwy.googlegroups.com>

I thought people would be interested in this little script I wrote to
reproduce the 256 simple automata that is shown in the first chapters
of "A New Kind of Science". You can see a few results without running
the script, at http://cooper-j.blogspot.com . And here is the code (You
will need PIL (Python Imaging Library)):
<code>
import Image

# Contract:
# To simulate simple cellular automata.

class calculations:
    def __init__(self,which):
	self.against = self.array_maker_2()[which]
	self.check = self.array_maker_1()
	self.array = self.array_maker_3(311)
	self.calculator()

    def binary(self, n, size): ## This is the Int -> str(BINARY)
converter
	assert n >= 0
	bits = []
	while n:
	    bits.append('01'[n&1])
	    n >>= 1
	bits.reverse()
	result = ''.join(bits) or '0'
	for iteration in range(len(result),size):
	    result = "0" + result
	return result

    def array_maker_1(self): # This makes the array that represents the
8 different permutations of 3 cells. Itself, its left and its right.
	return [self.binary(n, 3) for n in range(8)]

    def array_maker_2(self): # This makes the array that represents
every single different rule. If for instance the second element in one
    # of these rules is 1, then the corresponding permutation that may
be found in the result array (array_maker_3), will be 1 (black).
	return [self.binary(n, 8) for n in range(256)]

    def array_maker_3(self, y): # This is the array for all the
results. The automaton starts from the middle of the first row
	x = [["0" for x in range((2*y)+1)] for n in range(y)]
	x[0][(2*y+1)/2] = "1"
	return x

    def calculator(self): # This cycles over all of the cells, and
scans one row at a time, and changes the next row according to the
current cell.
	self.buff_result = ["0","0","0"] # This is the current permutation
buffer to be checked against the corresponding arrays.
	for i in range(len(self.array)-1):
	    for j in range(1, len(self.array[0])-1):
		self.step1(j,i)
		self.step2(j,i)
		self.step3(j,i)
		y = self.check.index(''.join(self.buff_result))
		self.array[i+1][j] = self.against[y]

# The steps update the result buffer.
    def step1(self, step, y):
	self.buff_result[0] = self.array[y][step-1]

    def step2(self, step, y):
	self.buff_result[1] = self.array[y][step]

    def step3(self, step, y):
	self.buff_result[2] = self.array[y][step+1]

for number in range(256):
    objo = calculations(number)
    x = objo.array
    y = []
    for num,zo in enumerate(x):
	for com,wo in enumerate(zo):
	    x[num][com] = int(wo)

    nim = Image.new("1", (623,311))

    for n in x: #converting the array of arrays into a single array so
putdata can take it.
	for p in n:
	    y.append(p)
    nim.putdata(y)
    nim.resize((6230/2,3110/2)).save("output" + str(number) + ".png")
    print number
</code>



------------------------------

Date: 24 Jun 2006 07:35:00 -0700
From: "placid" <Bulkan@gmail.com>
Subject: Re: Python and cellular automata (It works this time!)
Message-Id: <1151159700.344882.304100@g10g2000cwb.googlegroups.com>


defcon8 wrote:
> I thought people would be interested in this little script I wrote to
> reproduce the 256 simple automata that is shown in the first chapters
> of "A New Kind of Science". You can see a few results without running
> the script, at http://cooper-j.blogspot.com . And here is the code (You
> will need PIL (Python Imaging Library)):
> <code>
> import Image
>
> # Contract:
> # To simulate simple cellular automata.
>
> class calculations:
>     def __init__(self,which):
> 	self.against = self.array_maker_2()[which]
> 	self.check = self.array_maker_1()
> 	self.array = self.array_maker_3(311)
> 	self.calculator()
>
>     def binary(self, n, size): ## This is the Int -> str(BINARY)
> converter
> 	assert n >= 0
> 	bits = []
> 	while n:
> 	    bits.append('01'[n&1])
> 	    n >>= 1
> 	bits.reverse()
> 	result = ''.join(bits) or '0'
> 	for iteration in range(len(result),size):
> 	    result = "0" + result
> 	return result
>
>     def array_maker_1(self): # This makes the array that represents the
> 8 different permutations of 3 cells. Itself, its left and its right.
> 	return [self.binary(n, 3) for n in range(8)]
>
>     def array_maker_2(self): # This makes the array that represents
> every single different rule. If for instance the second element in one
>     # of these rules is 1, then the corresponding permutation that may
> be found in the result array (array_maker_3), will be 1 (black).
> 	return [self.binary(n, 8) for n in range(256)]
>
>     def array_maker_3(self, y): # This is the array for all the
> results. The automaton starts from the middle of the first row
> 	x = [["0" for x in range((2*y)+1)] for n in range(y)]
> 	x[0][(2*y+1)/2] = "1"
> 	return x
>
>     def calculator(self): # This cycles over all of the cells, and
> scans one row at a time, and changes the next row according to the
> current cell.
> 	self.buff_result = ["0","0","0"] # This is the current permutation
> buffer to be checked against the corresponding arrays.
> 	for i in range(len(self.array)-1):
> 	    for j in range(1, len(self.array[0])-1):
> 		self.step1(j,i)
> 		self.step2(j,i)
> 		self.step3(j,i)
> 		y = self.check.index(''.join(self.buff_result))
> 		self.array[i+1][j] = self.against[y]
>
> # The steps update the result buffer.
>     def step1(self, step, y):
> 	self.buff_result[0] = self.array[y][step-1]
>
>     def step2(self, step, y):
> 	self.buff_result[1] = self.array[y][step]
>
>     def step3(self, step, y):
> 	self.buff_result[2] = self.array[y][step+1]
>
> for number in range(256):
>     objo = calculations(number)
>     x = objo.array
>     y = []
>     for num,zo in enumerate(x):
> 	for com,wo in enumerate(zo):
> 	    x[num][com] = int(wo)
>
>     nim = Image.new("1", (623,311))
>
>     for n in x: #converting the array of arrays into a single array so
> putdata can take it.
> 	for p in n:
> 	    y.append(p)
>     nim.putdata(y)
>     nim.resize((6230/2,3110/2)).save("output" + str(number) + ".png")
>     print number
> </code>

>

Ah, celular automata! Another of my on-off interest! I shall run this
as soon as posible.



------------------------------

Date: 24 Jun 2006 07:53:49 -0700
From: "defcon8" <defcon8@gmail.com>
Subject: Re: Python and cellular automata (It works this time!)
Message-Id: <1151160829.035910.237320@p79g2000cwp.googlegroups.com>

Sorry about the code. It seems to have been truncated. I have it hosted
at

http://xahlee.org/x/realautomata.py

Thanks to Xah Lee.



------------------------------

Date: Sat, 24 Jun 2006 06:28:34 GMT
From: Mark Healey <dont@like.spammers>
Subject: Regexp problem
Message-Id: <pan.2006.06.24.06.28.33.359539@like.spammers>

Here is the line that is giving me problems:

$Falbum =~ s/$edir\/.\/$Fartist\///;

The problem is that $Fartist sometimes has grouping characters "()[]"
which screws up the search.  

How do I get it to treat these characters as if they were "\(\)\[\]"?

-- 
Mark Healey
marnkews ãt healeyonline döt com



------------------------------

Date: Sat, 24 Jun 2006 06:32:29 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Regexp problem
Message-Id: <105ng.1623$il.185@trnddc03>

Mark Healey wrote:
> Here is the line that is giving me problems:
>
> $Falbum =~ s/$edir\/.\/$Fartist\///;
>
> The problem is that $Fartist sometimes has grouping characters "()[]"
> which screws up the search.
>
> How do I get it to treat these characters as if they were "\(\)\[\]"?

perldoc -f quotemeta

jue 




------------------------------

Date: Sat, 24 Jun 2006 00:20:01 -0700
From: Adam Smith <adamsmith@econ.com>
Subject: Re: Script debugging  - NOPE !!! Installation Failure??
Message-Id: <SbCdnTB5Q6mxegHZnZ2dnUVZ_rGdnZ2d@speakeasy.net>

Actually discovered that this is an Installation Problem apparently. 
Merely, launching Perl produces the Undefined symbol condition. 
Suggestions sought.



Adam Smith wrote:

> Hi,
> 
> Platform i386, freeBSD 4.9 O/S
> 
> I am running a perl cgi script and am getting an error message to my 
> http error log files
> ==> /usr/libexec/ld-elf.so.1: 
> /usr/local/lib/perl5/5.8.2/mach/CORE/libperl.so: Undefined symbol 
> "nl_langinfo"
> 
> grep'ing seems to localize the problem in the libperl.so library
> 
> grep -in nl_langinfo /usr/local/lib/perl5/5.8.2/mach/CORE/libperl.so
> Binary file /usr/local/lib/perl5/5.8.2/mach/CORE/libperl.so matches
> 
> but I am at a bit of a loss as to how best to proceed, just need a 
> directional push start.
> 
> Anyone up to the task?
> 
> -- Adam --


------------------------------

Date: Sat, 24 Jun 2006 14:50:16 +0100
From: Ben Morrow <benmorrow@tiscali.co.uk>
Subject: Re: Script debugging 
Message-Id: <ohsvm3-e57.ln1@osiris.mauzo.dyndns.org>

[f'ups set]

Quoth Adam Smith <adamsmith@econ.com>:
> Platform i386, freeBSD 4.9 O/S
> 
> I am running a perl cgi script and am getting an error message to my 
> http error log files
> ==> /usr/libexec/ld-elf.so.1: 
> /usr/local/lib/perl5/5.8.2/mach/CORE/libperl.so: Undefined symbol 
> "nl_langinfo"

At least on my system (linux), nl_langinfo is defined in libc.so. Have
you upgraded your libc since you installed perl? What do you get if you
run 'ldd /usr/local/lib/perl5/5.8.2/mach/CORE/libperl.so'?

I suspect the only solution is to rebuild perl, unless your system's
really badly broken.

Ben

-- 
               We do not stop playing because we grow old; 
                  we grow old because we stop playing.
                        benmorrow@tiscali.co.uk


------------------------------

Date: Sat, 24 Jun 2006 07:18:53 -0700
From: Adam Smith <adamsmith@econ.com>
To: Ben Morrow <benmorrow@tiscali.co.uk>
Subject: Re: Script debugging 
Message-Id: <449D49CD.2030306@econ.com>

Hi Ben,
thanks for the reply , I got the following to the lld
#> ldd /usr/local/lib/perl5/5.8.2/mach/CORE/libperl.so
/usr/local/lib/perl5/5.8.2/mach/CORE/libperl.so:
libm.so.2 => /root/usr/lib/libm.so.2 (0x281f8000)
libcrypt.so.2 => /root/usr/lib/libcrypt.so.2 (0x28214000)
libutil.so.3 => /root/usr/lib/libutil.so.3 (0x2822d000)
libc.so.4 => /root/usr/lib/libc.so.4 (0x28072000)

Ben Morrow wrote:

> [f'ups set]
> 
> Quoth Adam Smith <adamsmith@econ.com>:
> 
>>Platform i386, freeBSD 4.9 O/S
>>
>>I am running a perl cgi script and am getting an error message to my 
>>http error log files
>>==> /usr/libexec/ld-elf.so.1: 
>>/usr/local/lib/perl5/5.8.2/mach/CORE/libperl.so: Undefined symbol 
>>"nl_langinfo"
> 
> 
> At least on my system (linux), nl_langinfo is defined in libc.so. Have
> you upgraded your libc since you installed perl? What do you get if you
> run 'ldd /usr/local/lib/perl5/5.8.2/mach/CORE/libperl.so'?
> 
> I suspect the only solution is to rebuild perl, unless your system's
> really badly broken.
> 
> Ben
> 


------------------------------

Date: Sat, 24 Jun 2006 07:50:25 -0700
From: Adam Smith <adamsmith@econ.com>
Subject: Re: Script debugging 
Message-Id: <ruKdnVZ_uLQnzQDZnZ2dnUVZ_oadnZ2d@speakeasy.net>

Ben, BTW - you may be on to something I did install a Perl API for a 
program. That may have caused it

Ben Morrow wrote:

> [f'ups set]
> 
> Quoth Adam Smith <adamsmith@econ.com>:
> 
>>Platform i386, freeBSD 4.9 O/S
>>
>>I am running a perl cgi script and am getting an error message to my 
>>http error log files
>>==> /usr/libexec/ld-elf.so.1: 
>>/usr/local/lib/perl5/5.8.2/mach/CORE/libperl.so: Undefined symbol 
>>"nl_langinfo"
> 
> 
> At least on my system (linux), nl_langinfo is defined in libc.so. Have
> you upgraded your libc since you installed perl? What do you get if you
> run 'ldd /usr/local/lib/perl5/5.8.2/mach/CORE/libperl.so'?
> 
> I suspect the only solution is to rebuild perl, unless your system's
> really badly broken.
> 
> Ben
> 


------------------------------

Date: Sat, 24 Jun 2006 15:12:27 +0200
From: "Peter J. Holzer" <hjp-usenet2@hjp.at>
Subject: Re: Unwanted character "^@" in perl output
Message-Id: <sndj7e.soi.ln@teal.hjp.at>

Todd W wrote:
> "Peter J. Holzer" <hjp-usenet2@hjp.at> wrote in message 
> news:ffkg7e.c06.ln@teal.hjp.at...
> <a bunch of interesting encoding voodoo>
> 
> Hi Peter,
> 
> Where did you learn all this stuff?

On Usenet :-)

No, that's not entirely true, of course, but discussions in usenet
groups and mailing lists are where I learn most because they always
make me realize what I don't know, so I reread the documentation, write
small test scripts to prove (or disprove) some aspect, google for
missing bits, etc. So the real answer is: From all kinds of sources.

Since I've been programming for almost 23 years and discussing about
it on usenet for about 18 years now and character sets have been a
constant source of problems during all this time, I've accrued a bit of
knowledge about this topic (and I'm still learning something new all the
time).

> I'm getting in to doing work with international content. Though I'm limping 
> along, I couldn't, for example, discuss it intellegently.
> 
> I'd like to find some hardcopy for the bookshelf. Those that provide detail 
> in relation to perl, apache, relational databases, and web browsers would be 
> the most useful to me. Any suggestions?

No, sorry, I don't know any book which covers those topics. But then I
don't read many (non-fiction) books. As reference material I prefer
original documentation and standards, and if I'm looking for some
specific information, it is much faster to search the web than order
and read half a dozen books which may or may not contain it.

        hp

-- 
   _  | Peter J. Holzer    | Man könnte sich [die Diskussion] auch
|_|_) | Sysadmin WSR/LUGA  | sparen, wenn man sie sich einfach sparen
| |   | hjp@hjp.at         | würde.
__/   | http://www.hjp.at/ |   -- Ralph Angenendt in dang 2006-04-15


------------------------------

Date: Sat, 24 Jun 2006 12:50:59 +0200
From: "Peter J. Holzer" <hjp-usenet2@hjp.at>
Subject: Re: use binary operator on ascii text string
Message-Id: <je5j7e.coh.ln@teal.hjp.at>

Sherm Pendley wrote:
> David Squire <David.Squire@no.spam.from.here.au> writes:
>> Sherm Pendley wrote:
>>> David Squire <David.Squire@no.spam.from.here.au> writes:
>>>> ??? The characters in "abcdefg" already have bit 7 set on - as the
>>>> must since ord('a') is 97 > 64
>>> ??? The value of a bit is 2^position, starting at position 0.
>>> 2^7 = 128.
>>
>> I started counting at 1.
> 
> Yes, obviously - that's why I posted the correction. Beginning at one is
> incorrect in any base-n notation, not just binary. For any value of n, the
> value of position x as n^x. That only works when the positions are numbered
> starting with zero.
> 
> It's not a matter of personal preference or opinion, it's part of the math-
> ematical definition of base-n notation.

But base-n notation is not the only notation in use. For example, the
RFCs describing the IP protocol (RFC 791 etc.) count bits from the MSB
to the LSB. They also start at zero, so if that convention is used on
bytes, bit 0 has the value 128, bit 1 has the value 64, etc. So David
could have said that the characters already have bit 1 set on and
confused the hell out of everyone :-).

I have seen numbering from 1..n (from either direction) instead of
0..n-1, too, but I'm too lazy to look for a widely known example. (But
if you read mathematical papers you will notice that many prefer to use
indexes starting at 1, even if it makes the formulas (formulae?) more
complicated because they have to write (i-1) instead of i all the time.

I don't care much as long as it is consistent. What really annoys me are
people who start counting at zero but claim that "zeroth" is not an
English word, so they use "the seventh bit" and "bit 6" interchangeably.

        hp

-- 
   _  | Peter J. Holzer    | Man könnte sich [die Diskussion] auch
|_|_) | Sysadmin WSR/LUGA  | sparen, wenn man sie sich einfach sparen
| |   | hjp@hjp.at         | würde.
__/   | http://www.hjp.at/ |   -- Ralph Angenendt in dang 2006-04-15


------------------------------

Date: Sat, 24 Jun 2006 11:05:30 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: use binary operator on ascii text string
Message-Id: <_%8ng.1059$Gh.82@trnddc02>

Peter J. Holzer wrote:
> I don't care much as long as it is consistent. What really annoys me
> are people who start counting at zero but claim that "zeroth" is not
> an English word, so they use "the seventh bit" and "bit 6"
> interchangeably.

Sure as hell confusing.
But the first element in a Perl array happens to be the element with the 
index 0.

Guess it's just something you have to get used to.

jue 




------------------------------

Date: Sat, 24 Jun 2006 15:31:13 +0200
From: "Peter J. Holzer" <hjp-usenet2@hjp.at>
Subject: Re: use binary operator on ascii text string
Message-Id: <1rej7e.1ti.ln@teal.hjp.at>

David Squire wrote:
> ... such as this, which explicitly deals with bytes, rather than hoping 
> that that is what characters are in the default encoding:
> 
> ----
> 
> #!/usr/bin/perl
> use strict;
> use warnings;
> 
> while (my $line = <DATA>) {
>       chomp $line;
>       my @line_array = unpack 'C*', $line;
>       my @new_line_array = map {$_ | 64} @line_array;
>       my $new_line = pack 'C*', @new_line_array;
>       print "$new_line\n";
> }

I don't think this is a good idea, as it depends on whether $line is
stored as bytes or as UTF-8 internally, which shouldn't make any
semantic difference.

        hp

-- 
   _  | Peter J. Holzer    | Man könnte sich [die Diskussion] auch
|_|_) | Sysadmin WSR/LUGA  | sparen, wenn man sie sich einfach sparen
| |   | hjp@hjp.at         | würde.
__/   | http://www.hjp.at/ |   -- Ralph Angenendt in dang 2006-04-15


------------------------------

Date: Sat, 24 Jun 2006 15:07:42 +0100
From: David Squire <David.Squire@no.spam.from.here.au>
Subject: Re: use binary operator on ascii text string
Message-Id: <e7jgve$klu$1@news.ox.ac.uk>

Peter J. Holzer wrote:
> David Squire wrote:
>> ... such as this, which explicitly deals with bytes, rather than hoping 
>> that that is what characters are in the default encoding:
>>
>> ----
>>
>> #!/usr/bin/perl
>> use strict;
>> use warnings;
>>
>> while (my $line = <DATA>) {
>>       chomp $line;
>>       my @line_array = unpack 'C*', $line;
>>       my @new_line_array = map {$_ | 64} @line_array;
>>       my $new_line = pack 'C*', @new_line_array;
>>       print "$new_line\n";
>> }
> 
> I don't think this is a good idea, as it depends on whether $line is
> stored as bytes or as UTF-8 internally, which shouldn't make any
> semantic difference.

It was not clear to me from the OP what the actual application was. I 
guess I suspect that bit masking is more likely to be applied to bytes 
of data than characters...

 ... now, had he been masking with 32, I could imagine that this was a 
hacky way to convert things to lowercase.


DS


------------------------------

Date: Sat, 24 Jun 2006 15:04:02 GMT
From: David Hopwood <david.nospam.hopwood@blueyonder.co.uk>
Subject: Re: What is Expressiveness in a Computer Language
Message-Id: <Cvcng.463162$tc.6353@fe2.news.blueyonder.co.uk>

Anton van Straaten wrote:
> rossberg@ps.uni-sb.de wrote:
> 
>> I very much agree with the observation that every programmer performs
>> "latent typing" in his head 
[...]
>> But I also think that "latently typed language" is not a meaningful
>> characterisation. And for the very same reason! Since any programming
>> activity involves latent typing - naturally, even in assembler! - it
>> cannot be attributed to any language in particular, and is hence
>> useless to distinguish between them. (Even untyped lambda calculus
>> would not be a counter-example. If you really were to program in it,
>> you certainly would think along lines like "this function takes two
>> chuch numerals and produces a third one".)
> 
> Vesa raised a similar objection in his post 'Saying "latently typed
> language" is making a category mistake'.  I've made some relevant
> responses to that post.
> 
> I agree that there's a valid point in the sense that latent types are
> not a property of the semantics of the languages they're associated with.
> 
> But to take your example, I've had the pleasure of programming a little
> in untyped lambda calculus.  I can tell you that not having tags is
> quite problematic.  You certainly do perform latent typing in your head,
> but without tags, the language doesn't provide any built-in support for
> it.  You're on your own.

I can accept that dynamic tagging provides some support for latent typing
performed "in the programmer's head". But that still does not mean that
dynamic tagging is the same thing as latent typing, or that languages
that use dynamic tagging are "latently typed". This simply is not a
property of the language (as you've already conceded).

-- 
David Hopwood <david.nospam.hopwood@blueyonder.co.uk>


------------------------------

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 9367
***************************************


home help back first fref pref prev next nref lref last post