473,776 Members | 2,054 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Is Perl *that* good? (was: How's ruby compare to it older brother python)

In article <iL************ ***@news4.e.nsc .no>,
Leif B. Kristensen <ju******@solum slekt.org> wrote:
Jul 17 '05 #1
1 1717
Cameron Laird rose and spake:
In article <iL************ ***@news4.e.nsc .no>,
Leif B. Kristensen <ju******@solum slekt.org> wrote:
.
getting dynamic HTML pages up and running quickly. Perl is great for
its string-handling abilities. (On my Web pages, I actually call a
Perl script from PHP precisely for this reason.)

.
I hear this more often than I understand it. Perl certainly
does support many string-oriented operations. What's a speci-
fic example, though, of an action you feel more comfortable
coding in external Perl? I suspect there's something I need
to learn about PHP's deficiencies, or Perl's power.


I'm glad that you asked :-)

The routine is for a phonetic search in Norwegian 18th century names,
which can be spelled in an amazing number of different ways. As I found
that the Soundex algorithm was useless for Norwegian spellings, I
invented my own. It's not really an algorithm, but a series of
substitutions that reduces names to a kind of primitives. Thus, eg.
Berthe, Birthe, Bergitte, Bergit, Birgit, Børte, Berit, and Brit, which
actually are interchangeable spellings of the same name, are reduced to
BRT.

Here's a small sample:

$str =~ s/HN/N/g; # John --> JON
$str =~ s/TH/T/g; # Thor --> TOR
$str =~ s/CHI/KJ/g; # Torchild --> TORKJL
$str =~ s/CHE/KJ/g; # Michel --> MKJL
$str =~ s/KKE/KJ/g; # Mikkel --> MKJL
$str =~ s/KIEL/KJL/g; # Kield -> Kjeld ( --> KJL)
$str =~ s/CH/K/g; # Christen -> Kristen ( --> KRSTN)
$str =~ s/CA/KA/g; # Carl -> Karl ( --> KAL)
$str =~ s/RL/L/g; # Thorleif <=> Tollef <=> Tolf ( --> TOLF)

I use a Perl script to transform my genealogy data from a FoxPro
database to MySQL command scripts. Thanks to the excellent module
DBD::XBase by Jan Pazdziora, this is a quite simple task.

In theory, the web routine for phonetic searches might have been
implemented in PHP. The trouble with that is that I would have to
maintain both a PHP and a Perl version of the same routine. I find it
much easier to just copy and paste the whole mess (at present about 120
lines) between the encoding and the decoding routines in Perl, and run
an exec("perl norphon.pl $name") from PHP.

regards,
--
Leif Biberg Kristensen
http://solumslekt.org/
Validare necesse est
Jul 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
2467
by: Chris | last post by:
Hi I am posting this on both the perl and python groups My intention is not to start a war or anything else, I would just like some pragmatic advice. My apologies to the python group I am not very conversant with Python at this stage. that could change soon though.
13
2711
by: Wayne Folta | last post by:
I've been a long-time Perl programmer, though I've not used a boatload of packages nor much of the tacky OO. A couple of years ago, I decided to look into Python and Ruby. Python looked OK, but not that different. I did like the indent-as-group idea, which was different. Ruby looked very cool. But it was impossible to get good documentation. It seemed like a Japanese cult with a few western initiates. Well, MacOS X ships with Perl,...
30
3480
by: Christian Seberino | last post by:
How does Ruby compare to Python?? How good is DESIGN of Ruby compared to Python? Python's design is godly. I'm wondering if Ruby's is godly too. I've heard it has solid OOP design but then I've also heard there are lots of weird ways to do some things kinda like Perl which is bad for me. Any other ideas?
42
4110
by: Fred Ma | last post by:
Hello, This is not a troll posting, and I've refrained from asking because I've seen similar threads get all nitter-nattery. But I really want to make a decision on how best to invest my time. I'm not interested on which language is better in *general*, just for my purpose. My area of research is in CAD algorithms, and I'm sensing the need to resort to something more expedient than C++, bash scripting, or sed scripting.
77
4065
by: Hunn E. Balsiche | last post by:
in term of its OO features, syntax consistencies, ease of use, and their development progress. I have not use python but heard about it quite often; and ruby, is it mature enough to be use for developing serious application, e.g web application as it has not many features in it yet. I've given up on Perl for its ugly syntax and it is not the easiest language to learn. How about PHP? Thanks
31
4807
by: surfunbear | last post by:
I've read some posts on Perl versus Python and studied a bit of my Python book. I'm a software engineer, familiar with C++ objected oriented development, but have been using Perl because it is great for pattern matching, text processing, and automated testing. Our company is really fixated on risk managnemt and the only way I can do enough testing without working overtime (which some people have ended up doing) is by automating my...
2
2925
by: calfdog | last post by:
Hello, I was wondering if anyone could tell me why fireEvent works in every language but Python with the latest Internet Explorer? I tried this page that has two listboxes if you select Listbox A the Listbox B should change. The code status: Works fine with Python 2.3, 2.4 in Windows XPsp1
16
2728
by: English Teacher | last post by:
Which would be a more useful language to learn, Smalltalk or Pearl? Learning curves any different? Thanks!
0
9747
by: Kirt Loki Dankmyer | last post by:
So, I download the latest "stable" tar for perl (5.8.7) and try to compile it on the Solaris 8 (SPARC) box that I administrate. I try all sorts of different switches, but I can't get it to compile. I need it to be compiled with threads. Anyone have any wisdom on how best to do this? Here's a transcript of my latest attempt. It's long; you might want to skip to the bottom, where I try "make" and the fatal errors start happening.
0
9459
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10282
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10056
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9920
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8948
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7467
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6721
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5365
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3619
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.