Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

osfameron (3135)

  (email not shown publicly)

Technorati Profile []

Journal of osfameron (3135)

Thursday May 30, 2002
05:22 AM

VBA ne Perl

[ #5295 ]
Continuing on my Off-Topic rant: I hate VBA.

On the other hand, I've managed to get a reasonably complex parser written in it.
Taking a name - - it will split it into First, Mid, and Last names. Trivial? But our email address books have oddities like Dutch names having the prefix added to the first name - And of course these prefixes should be part of the Middle name (to make alphabetising surnames less 'V' heavy...) whereas French prefixes shouldn't ("Le Brun")

With the various rules that we need to follow for this, it's a tricky but fundamentally doable task for Perl and Regular Expressions, but a horrible tarpit for VBA.

On topic?: Perl helped me write this application:

  • First I wrote helper functions to recreate some of the functionality of Perl lists, and to avoid having to manually parse everything in every sub.
  • I've learned how to manipulate lists in Perl, and you can play with lists the Perl way in VBA too, which is invaluable.
  • Perl coding practise encouraged me to split things into subroutines. This is painful in VBA - my colleague who I thought of as a VB guru actually advised me to use Cut and Paste instead in some cases... and I will admit that one Function is about 150 lines long because I just couldn't bear to refactor it. But I tried...

But no matter how you apply the Perlish way to VBA, it is not Perl... Some of the things I missed from Perl were:

  • use strict;

    (I don't think that

    Option Explicit

    is the same)

  • Exception handling a little more sophisticated than

    On Error Goto

  • warnings, diagnostics, helpful error messages.
  • Not having to use the default IDE. (Tasty Vim goodness).

Programmers are always encouraged to learn other languages to get to grips with their features and constructs. I'm wondering whether I could recommend learning VB as a counter-example...?

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • Isn't there some overlap between Dutch and French surname prefixes? At least de, as in de Klerk and de Gaulle?
    • Yes, I thought of that only an hour ago... I guess I need a flag for "Dutch style" or "French style" parsing of 'de' prefixes, phew!


      • Hmmm, in our email address-list most of the names are set up so that

        French:   Charles.De-Gaulle
        Dutch:    Wijnand-de.Witte

        e.g. there are 2 differences:

        1. French 'De' is usually Title Case, while Dutch 'de' is usually lower case.
        2. More consistently, the Dutch name is coded Firstname-de, and the French De-Lastname

        I've made use of the 1st fact to make all "De" part of the last name. However I can't use the 2nd fact without a rewrite because of the (rather crufty) procedure I used to par