Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

gandolf1212

Perl under rated?

This topic is 5858 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Well, I decided to learn Perl for cgi scripts which it seems most commonly used for. After working a little bit with it though it seems like it could prove a useful language for anything. I''ve done C++ for a few years now but after a few days with Perl i''m about ready to switch over. Reasons why you ask? + String management! God I love this one! No more String class or char *word or char word[515]. Not only does it it have all the operators overloaded for strings it comes with functions like split. Plus it resizes your string to hold any sized word. + File IO is very easy + No declarations, variables are made when there used + No types, just like java-script + 2 array types! Your standard subscript array and an associative array which lets you (among other things) use words for subscripts. Great for CGI. + Condition false controls. Like unless and until. + The for each loop which is made to go through array''s. + Cool array features like being able to find out how big it is real easy and commands like pop and push and sort. + Pretty much everything else that is in a high level language. Plus it can be script or binary. + Condition false controls. Like unless and until. + The foreach loop which is made to go through array''s. + Cool array features like being able to findout how big it is real easy and commands like pop and push and sort. + Pretty much everything else thats in a high level language. Plus it can be script or binary. Soo.. My question is why don''t more people use and like Perl. I have heard that the preformance is a little less than C++ or Pascal but i''m not sure. Is there somthing major that Perl lacks or falls short with? I just want to make sure Perl really is as good as C++. Hate to find out after 9 months or doing Perl it has a hard coded limit of 5 fps or something =) Thanks alot for any input.

Share this post


Link to post
Share on other sites
Advertisement
quote:
Original post by gandolf1212
+ String management! God I love this one! No more String class or char *word or char word[515]. Not only does it it have all the operators overloaded for strings it comes with functions like split. Plus it resizes your string to hold any sized word.

+ The for each loop which is made to go through array''s.

+ Cool array features like being able to find out how big it is real easy and commands like pop and push and sort.

+ The foreach loop which is made to go through array''s.



I assume you dont like the STL



I will not make a list of links... I will not make a list of links... I will not make a list of links...
Invader''s Realm

Share this post


Link to post
Share on other sites
I have absolutely no objection to people writing in Perl, but I personally think the syntax and readability of it is atrocious... some programs I have seen are like trying to read a Chinese restaurant menu that has been encrypted in triple-DES

To each his own I guess...

Share this post


Link to post
Share on other sites
You might want to take a look at Python (www.python.org), it has all the power of C++ with the benifits of perl and a readable syntax.

I use it all the time for just about everything. There are even OpenGL binds for it so you can do 3d graphics work with it.

Andrew

Share this post


Link to post
Share on other sites
Ummm... okay, Perl = Games? The syntax alone makes it useless for anything larger than a CGI script

It''s been a few years since I''ve used it and from what I understand, it''s evolved but the syntax seems to have gotten worse.

If you''re lookin'' for advice, I''d strongly suggest stickin'' with C++. Invader X mentioned STL. Look into it a bit. G'' luck!

- Jay

"Strictly speaking, there is no need to teach the student, because the student himself is Buddha, even though he may not be aware of it." - Shunryu Suzuki

Get Tranced!

Share this post


Link to post
Share on other sites
Perl''s pretty good, it''s got quite a rich syntax (e.g. native support for hash tables, and regular expressions, like you said) which means you can do some things in one line which may take tens or hundreds of lines in C++, but for that same reason, people tend to get a bit carried away trying to fit things in as few lines as possible

If you can resist that temptation, perl is very good for a lot of things, though it was really only meant for short scripts which have lots of string manipulation and so on. For other things, it''s not going to be as good (due to a lack of libraries, mainly)


codeka.com - Just click it.

Share this post


Link to post
Share on other sites
I'm not saying it's as easy as Perl but the STL string class is pretty powerful, along with containers, stl algo ,stringsteam etc.

[edited by - Dark Rain on June 9, 2002 6:08:18 AM]

Share this post


Link to post
Share on other sites
OH MY GOD - sure that you really have done C++ programming on anything more than a small scale?

quote:
Original post by gandolf1212
Well, I decided to learn Perl for cgi scripts which it seems most commonly used for. After working a little bit with it though it seems like it could prove a useful language for anything. I''ve done C++ for a few years now but after a few days with Perl i''m about ready to switch over. Reasons why you ask?

+ String management! God I love this one! No more String class or char *word or char word[515]. Not only does it it have all the operators overloaded for strings it comes with functions like split. Plus it resizes your string to hold any sized word.


Not exactly a perl specific thing, you know. Actually most high level languages can do this. Oh, and when you write a complex 3d game, you will definitly make most of your work in this area, right? And look at the C++ classes for stings - they are pretty good, too. C++ is more than just the syntax.

quote:

+ File IO is very easy



As is it in most other languages, and even in C++.

quote:

+ No declarations, variables are made when there used



Yea, right, writing shitty code. means that if you mistype a variable name, then the program misbehaves instead of the compiler complaining.

quote:

+ No types, just like java-script



Yea, right - writing shitty code is an advantage. Strong typed variables help you catch errors in anything more complex than a simple CGI script - by having the compiler throw an error.

quote:

+ 2 array types! Your standard subscript array and an associative array which lets you (among other things) use words for subscripts. Great for CGI.



Look up on STL and learn C++. Please.

quote:

+ Condition false controls. Like unless and until.

+ The for each loop which is made to go through array''s.



Well. foreach is pretty nice and shugar (though I LOIVE this when making my C# work - whow :-)

quote:

+ Cool array features like being able to find out how big it is real easy and commands like pop and push and sort.



Now, lets clarify this - you DO know C++? I mean, you ever heard of STL? Just to make sure - oh, you said so. Well...

quote:

+ Pretty much everything else that is in a high level language. Plus it can be script or binary.



And you can make such wonderfull complex systems with it - I mean, things like a control system with 15.000 db transactions a second. Oh, sorry - ou just want to write gaems not using up all CPU or small CGI scripts.

quote:

+ Condition false controls. Like unless and until.

+ The foreach loop which is made to go through array''s.

+ Cool array features like being able to findout how big it is real easy and commands like pop and push and sort.

+ Pretty much everything else thats in a high level language. Plus it can be script or binary.



Repetition - running out of arguments?

quote:

Soo.. My question is why don''t more people use and like Perl. I have heard that the preformance is a little less than C++ or Pascal but i''m not sure. Is there somthing major that Perl lacks or falls short with? I just want to make sure Perl really is as good as C++. Hate to find out after 9 months or doing Perl it has a hard coded limit of 5 fps or something =) Thanks alot for any input.


Well,
(a) most game developers want every bit of performance. I can NOT understand this - a little less speed in the core language will not make a huge difference. 10% loss are definitly acceptable IMHO (dont forget - when you go graphics it is hardware accelerated anyway). Thats why I opt for C#, but thats another story.

PRACTICALLY all API is written in C++ - means that you easily get C++ header files for OpenGL, DirectX etc., but no perl implementation. And then, use a tool for what it is done - Perl is done for analyzing logfiles (RL in Perl: Reporting Language).

Frankly, you expose quite some "non-knowledge" about C++ - like not knowing STL at all. I am not sure I would call you even an apprentice C++ developer.

THONA
[
Thomas Tomiczek
THONA Consulting Ltd.
(Microsoft MVP C#/.NET)
http://www.thona-consulting.com/
]

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
quote:
Original post by gandolf1212
+ Condition false controls. Like unless and until.


#define unless(x) if( !(x) )
#define until(x) while( !(x) )

There. There''s your unless and until.

Share this post


Link to post
Share on other sites
Perl is definitely a language that should be on most people''s list of known languages. But the important thing to remember is "the right tool for the right job". Perl is excellent for things like text-parsing, simple file-handling, and to some extent web-programming, although I prefer Java servlets and PHP for anything more than very simple CGI-scripts myself.

As has been pointed out, Perl isn''t exactly the fastest language you can use, but when throwing together something like an apache-log analyzer, I wouldn''t even consider doing that in C/C++.

When it comes to the complaints about horrible syntax, that is more a result of the fact that perl is very much used for text-parsing, and reg-exps are really the best way to go for that, often leading to expressions like
$var ~= s/(.*?)\\(.*)/($2);
(Which is not by far a bad expression compared to other you regularily see bandied about perl-scripts).
And although these kinds of expressions can be difficult to figure out if you''re not used to reading regexps, but can lead to very terse code (which most perl-hackers love even more than C-programmers).

Anyway, at the risk of overly repeating myself, "right tool for the right job".

-Neophyte

-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GED d- s:+ a- C++$ UL++ P++ L++ E W+ N+ o K? w !O M--(+) V-- PS+
PE Y+ PGP t-- 5++ X+ R(+) rv+(++) b+++ DI+ D(+) G e+>++ h r--> y+
----- END GEEK CODE BLOCK-----
geekcode.com

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!