I suppose it is bad form to write an off-topic post on my first use.perl journal entry. Well, not quite off topic, as it's about me struggling to use VBA in Excel to do things the Perlish way.
First off, there are no Regular Expressions (you can import them from WSH version 2, but that's not installed on our corporate build, so no joy).
Also, I'm having fun implementing basic functionality... Here are some list munging functions. Actually, they don't use VB's braindead arrays, but the "Collection" object, which is slightly less braindead, and more like a Perl list.
Function split(split_string As String, orig_string As String) As Collection 'OK not really like Perl split, 'e.g. only split on literals Dim coll As New Collection Dim pos pos = 1 Dim my_string As String my_string = orig_string While my_string <> "" And pos <> 0 pos = InStr(1, my_string, split_string) If pos > 0 Then coll.Add Left(my_string, pos - 1) my_string = mid(my_string, pos + Len(split_string)) End If Wend coll.Add my_string Set split = coll End FunctionAnd the positively minimalist 'join' function.
Function join(jstring As String, coll As Collection) As String Dim token As Variant For Each token In coll If join <> "" Then join = join & jstring join = join & token Next End FunctionTo compare with Perl ("Make easy things easy, and hard things possible"), VBA is very good for manipulating the Excel object model and can clearly do many very difficult things easily. It just falls down in some simple things, which appear to be impossible or at least pointlessly difficult.
In fact, it's par for the course. I can say that, because I did it, too.
Welcome.
I've created a VBA module with a number of Perllike list utilities - makeList, makeHash, split, join, push, pop, shift etc.. I was going to post the module for your interest, (if you're using VBA, or just want to laugh at the tortuous syntax) but I got this use.perl error:
How appropriate. If you want a copy of this, give me a shout (/msg me on perlmonks for example).Lameness filter encountered.
Your comment violated the "postercomment" compression filter. Try less whitespace and/or less repetition. Comment aborted.