algebaric operations on a RegEx?

Madison Kelly linux-5ZoueyuiTZhBDgjK7y7TUQ at public.gmane.org
Mon Apr 6 19:55:37 UTC 2009


First and foremost, I don't want to be seen trying to talk you into a 
language you are unhappy with. Different languages for different 
folks... To answer your questions though...

Lennart Sorensen wrote:
> Well the more I use perl the more I start to dislike it.  The syntax
> is just awful.  Too inconsistant, too many ways to do the same thing.
> Too much magic that makes things that you don't want be legal syntax
> yet do nothing useful.  I still use perl, because well I know it.
> I do try to avoid all the nifty features that makes perl hard to read.
> Many nice languages grow on you with use.  Perl does the opposit after
> a while.

Like Linux; It's strength is also it's weakness - choice.

> Things I dislike are:
> push(@myarray,\%foo) [why do I need to do that?]

\%hash, \@array, \{} (where {} contains code or a function) is a way to 
create a pointer to an existing hash, array, code chunk or such rather 
than copying said item. Saves a lot of memory, specially with big items. 
So in your case, you'd *want* to do that if you wanted to reference a 
hash as an element at the end of your array.

Now why you would want to do that is up for discussion. ;)

> and then reletated to that:
> $foo{'bar'} versus $foo->{'bar'}.  Why does one work and the other not

$foo{'bar'} calls up the entry with the key 'bar' in the HASH 'foo'. 
However $foo->{'bar'} calls up the entry with the key 'bar' in the HASH 
REFERENCE 'foo'. A reference (be it a hash, array, code chunk or other) 
is a simple pointer stored in a string variable.

An alternative, though deprecated, way to reference the hashref above 
would be: $$foo{'bar'}. This is ugly as sin, but can also be described 
as '${$foo}{'bar'}, which is a combination of the two methods above.

> in this case?  Does perl have pointers and if so when?  Gah!
> There are plenty more ugle thigns in perl.

As Alex said, it has references, which are similar. A good example is 
the Net::DBus implementation with uses these references to call code 
functions when certain DBus events happen.

> Python is at least more consistant in syntax, although that too is a
> language suffering from evolution (too many features have been deprecated
> over time making old example code no longer valid syntax).

Python is a great language, but not flexible enough for me. See top of 
this message.

> php is quite nice.  I haven't used it for command line scripts, although
> it is perfectly possible.

PHP is likewise great, but too limiting for me. See top of this message.

:)

Madi
--
The Toronto Linux Users Group.      Meetings: http://gtalug.org/
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists





More information about the Legacy mailing list