[aklug] Re: Perl 5 OOP

From: barsalou <barjunk@attglobal.net>
Date: Thu Jan 07 2010 - 10:30:35 AKST

Quoting Christopher Howard <choward@indicium.us>:

>
> Thank you for a response. I didn't mean to sound sarcastic or
> argumentative. Just giving you an opportunity to tell me why you like Ruby=
.
>

Sounds like I miss interpreted what you were saying....

> I actually did go through one of the tryruby tutorials partially, and
> I'll probably finish in a day or two. Didn't get in deep enough to tell
> if I really liked it, but I did find some of the language to be rather
> "funky," as you mentioned. This one was quite strange to me, for example:
>
> Poem["Bob"] =3D "Tom"
>
> Which apparently replaces the word Bob with Tom in the string Poem.
> Kinda freaky, being quite used to square brackets being reserved for
> arrays and hashes.
>

I've never seen that before....normally I'd think this was a hash =20
assignment, however, if you initialize poem with "bob" before this =20
statement, then it does behave this way.

What is more interesting is that if you assign poem =3D "bobcat" and =20
issue the above command, you get the value "tomcat". So this looks =20
like a shortcut for string replacement although I've never used it =20
this way before.

If you try to issue the above assignment with poem not having been =20
assigned an initial string or assigned as a hash, you get:

undefined local variable or method `poem'

I'm going to investigate that a little further....thanks.

Mike B.

----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.

---------
To unsubscribe, send email to <aklug-request@aklug.org>
with 'unsubscribe' in the message body.
Received on Thu Jan 7 10:31:05 2010

This archive was generated by hypermail 2.1.8 : Thu Jan 07 2010 - 10:31:05 AKST