What are some practical applications for Perl?

Nick Estes plug-discuss@lists.plug.phoenix.az.us
Wed, 22 May 2002 08:12:49 -0700 (MST)


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

> Would you care to expand on that? What's your reason for saying this? Why is
> Ruby so good? What is Ruby? etc, etc....

When you start getting into Ruby, you'll notice that it borrowed a lot of
good ideas from a lot of other languages, without digging too deep, you'll
see language features inspired by Perl, Smalltalk, Lisp, and many others.
Matz (Ruby's daddy) took all of these things and integrated them very
well, trying to follow the principle of least surprise all the way.

Ruby is good for different reasons for different people, but for me, I
like it because it is a very powerful object oriented laguage that lets
the programmer say what he means without dancing around a funky syntax.

As for it's object orientation, _EVERYTHING_ in Ruby is an object, here's
an example:

puts "Hello world!"

As expected, that's a valid one liner in Ruby, much like you would see in
similar languages like Perl or Python.  The big difference in this case is
that by making that hello world program, 3 objects were used (one of them
was user created).  The code itsself, since it had no class definition of
it's own, was placed inside of the Object object (Object is the parent of
all objects in Ruby).  The puts call is a method call off of Object which
will look up your default output location (stdout in this case), and call
puts on whatever IO object that is with it's original arguments; for us,
those arguments were a string object we created.

Even integers in Ruby are objects which gives us some very powerful
possibilities.  For example, say we need to count from 1 to 10 for some
reason; your typical language will have you use a for loop for this, but
in Ruby, why not ask the Integer class how to count that way we don't have
to:

1.upto(10) do |number|
  puts number
end

Of course, if you really like for loops for some reason, Ruby will let you
do that too.

The list of things that Ruby does is a bit long to put in one e-mail, but
generally speaking, I like Ruby because it can do everything I need to do
in a way that is simpler and easier to read than in any other language
I've used.  If there's any specific langauge features you want to know
about, let me know.

Just so you know where in the programming spectrum I'm coming from, I know
C, C++, Perl, and Ruby very well, and I know Lisp, Haskel, PHP, assembly,
shakespere, forth, pascal, and a couple others at a more basic level. (and
Ruby is my favorite)

	--Nick

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: pgpenvelope 2.10.2 - http://pgpenvelope.sourceforge.net/

iD8DBQE867V2v+hjYTGg7s4RAtTyAJ9tESkModqrlBfstfenXoT+p8qs1ACgied4
ncDU4fgmZfHWrNuCUB/Q/3g=
=anmP
-----END PGP SIGNATURE-----