Skip to main content
gamedev.net
🔒 Locked

Perl?

Started by simbiant Aug 4, 2003 at 7:28 PM 9 replies 550+ views
Original Post
simbiant
simbiant
I''ve tried reading information on Perl from a few sources online, they all essentially just tell me "Perl is a language that gets things done." Well..that''s nice, but specifically what is Perl used for today? If you had to narrow it down to it''s most practical and common uses, that is.. Generally I''m wondering if it''s worth learning Perl. I''m at a point where I don''t need to learn more languages just for the beneficial experience of..knowing another programing language. What viable possibilities can Perl open up to a programmer that other languages can''t do, or that Perl is simply better at?
Sneftel
Sneftel
Perl was a language designed to be used to convert between different flat-text file formats, and to collect information from them (it stands for Practical Extraction and Reporting Language). Then, someone got the stupid idea of giving it more features, and more and more and more, without ever taking out the stuff that made it a bad language for anything but the very specific purpose for which it was designed in the first place. It uses virtually every punctuation mark out there, for absolutely random purposes which often change based on the context. It also lets you write a particular statement about 20 different ways, about 19 of which completely occlude the real purpose of the statement. You will almost never see a statement written the twentieth way; Perl programmers enjoy writing hard-to-read, hard-to-maintain code. For them, bizarre, obfuscated syntax is a badge of honor.

Useful if you want to annoy other people.


How appropriate. You fight like a cow.

[edited by - sneftel on August 4, 2003 8:50:48 PM]
guppy
guppy
as Sneftel pointed out perl was originaly made for data harvesting and has some powerfull language constructs for that ( such as native regular expressions ), and it has grown into a quite horrible language.

That beeing said it is quite use full as a batch enhacement, for scripting trivial tasks. I personaly use it on a regular basis, I do however get the fealing that it is mostly uses by sysop''s that wants to keep their jobs ( by making sure no one else can decifer their scripts ). eg : Some one once said that if a task cant be reduced to a perl oneliner ( a script of only one line ) it is due to poor programming skills.

so if you want a programming language that will help you with such task as cheking the network for open ports / proxies / programms that the users aren''t supposed to run - then go ahead and learn ( rather try to ) pearl. ( or prehaps TCL / bash scipts )

if you want to make games then perl would be a waste of your time..

oh btw, perl is a scripting language and as such requires a run time interpeter. ( as opposed to say .exe files )

hope that helps.



/Please excuse my bad spelling - My native language is binary not english
|Visit me
\Take my advice - I don''''t use it...
/Please excuse my bad spelling - My native language is binary not english|Visit meTake my advice - I don''t use it...
Interim
Interim
It is a language for getting stuff done. There are plenty of admins and even developers who utilize scripts vs compiled languages for debugging, testing, and automation.

Perl, when it was introduced, was a huge blessing to Unix admins who felt limited by shell scripts. Perl quickly moved to other platforms, and made a huge niche as a CGI script of choice for many popular web sites. Its builtin regex and text manipulation functions made it popular for parsing text files (ie, doing anything on Unix).

Python lately has been getting more attention IMHO. Perl, while a good language, suffers from its own syntax, making it hard to maintain and even review (including your own work if you''re not diligent in documenting or using proper structures).

Both languages have compilers by the way. I like Pythons a bit better, they both produce slow, fat exe''s, so they''re no replacement for C/C++. However, if you want a simple, distributable "program" that isn''t speed dependent, they both do nicely.

Another trick for distribution is to just place the interpreter on a remote machine and run the entire script remotely. (x:\python myscript.py)

Perl is very active in web development. There is plenty of Perl code doing admin tasks, development work, and other assorted tasks. I''ve heard of companies replacing entire DB front ends with Perl. Perl has a massive library of modules that will do anything you can think of (SNMP, SMTP, CGI, etc). It''s called CPAN.

If you''re curious why to learn Perl, or another strong scripting language, I can think of plenty. Both support embedding and extending, meaning you can run them from within C/C++ programs, or writing C/C++ modules that can be called from within the script. This allows developers to create unit tests capable of testing library functions without creating custom C/C++ unit testing programs. Both are much more efficient for web development, especially now that Python has modpython for Apache. You can use them to prototype algorithms before investing heavily in writing the actual C/C++ code. Finally, writing scripts is usually much faster than full programs since they offer strong abstraction of data types and plenty of modules for common tasks (more code reuse).

I''ve seen both Python and Perl running in production environments where uptime was critical, or just demanded (grin) without problems.

Int.
RenderTarget
RenderTarget
I use Perl for we backends. All my cgi stuff is Perl. That''s not to say it''s the best thing for it, but there are reasons to love or hate Perl.

It seems to me that the main goal of Perl switched from ''how well can we manipulate text?'' to ''how small can we allow you to write code that does big things to manipulate text?'' It''s full of invisible variables and implied contexts, so reading undocumented Perl code is like deciphering Hebrew.

For instance, to write a program that outputs the contents of every file you listed on the command line, your entire Perl program can consist of:

#!/usr/bin/perl
while( <> )
{ print; }

You can also do wacky things with numbers and strings:

$sValue = 12;
print $sValue . " Monkeys";

There are decent libraries for linking to databases and such, and it''s fantastic with text. Builtin regular expression parsing and translation are excellent for data-driven websites, which is all I use it for. It can be fun to wrangle, but if you don''t document everything and work on your code every few weeks, you''ll totally forget how your own stuff works.

I like pie.
[sub]My spoon is too big.[/sub]
RapidStunna
RapidStunna
At my job, my first project was in perl. Perl is NOT outdated. Go to www.activestate.com and download the free ActivePerl I believe. You probobly should also use an editor such as Crimson Editor or UltraEdit.

Perl is specifically good for file parsing and management. That''s what it''s known for. Many of it''s components are available in C++ also, but they are found as extensions in STL (like maps for associative arrays) and and BOOST (such as regular expressions).

---
Brent Gunning | My Site
Sneftel
Sneftel
I would have expected someone else to have said this directly, but I guess I''ll come out with it: If you''re jonesing for a new language to learn, one that will actually be of use to you and help you grow and improve as a programmer, learn Lisp. Functional Programming is a wildly different programming paradigm in many ways, and will teach you to take new approaches to problems.


How appropriate. You fight like a cow.
PhiberOptic
PhiberOptic
I don''t know much about Perl, but as far as I know, the programmingstyle is pretty similar to highlevel languages like C++/Python/Basic. However, like Sneftel said, if you want to try something new, learn LISP, scheme, ASM or something fun(?)

I''ve found LISP to be pretty different from regular programming and new ways of thinking, like more recursion, is a good element. :-)

----------------------------------------------
Petter Nordlander

"There are only 10 kinds of people in the world. The who understand binary and those who don''t"
----------------------------------------------Petter Nordlander"There are only 10 kinds of people in the world. They who understand binary and those who do not"
daerid
daerid
I would love to use/learn LISP. However, I can''t find a single decent Windows distribution with an easy to use compiler, and it''s even harder to find a straight-forward reference/tutorial for the syntax itself.

If I could find those, I''d start coding LISTP like mad, prolly
daerid@gmail.com
wild_pointer
wild_pointer
Check the links section of 'My Site' in my sig. I have a handful of lisp links I've found useful.

I can't really help you with an environment. Try Corman lisp; you can use it for free but there are some restrictions.



[My site|SGI STL|Bjarne FAQ|C++ FAQ Lite|MSDN|Jargon]
Ripped off from various people

[edited by - wild_pointer on August 6, 2003 6:06:59 AM]
[size=2]

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.