With regards to your angst about strings and numbers ... flip your thinking. You're worried about making a mistake and using a string or number where you shouldn't have and getting wonky results because of it. That's a valid worry and every single monk worth their salt has had it bite them in the ass, easily losing a day or two of working time.
So, we stop using Perl, right?
Naaah! Instead, consider the following points:
- Perl was initially designed to process "stuff". One of its most common uses is to handle CGI "stuff". Having worked with CGI stuff in C++, the http server will give you everything in strings. That would've gotten real annoying in C, but C++ had these neat overloaded operators for me, so I could add two strings together. Perl takes that idea and makes it better.
- Ever since I started working with Perl, especially OO Perl app development, my skill as a developer has improved. In some cases, by leaps and bounds. Perl lets you do (nearly!) anything you want. But, if you want to work with it three months from now or if you want to work with it in a remote-development group, you'd better do it intelligently. Because Perl doesn't force you to design, it lets you design better. It lets you make the mistakes, then allows you to do it right. This means that I (now) naturally name variables and structure programs so that the number / string issue, well, isn't an issue. :-)
- If the above points don't convince you, consider that there are thousands of extremely smart developers who wish that every language they have to work in has X feature from Perl. (For me, it's hashes and regexes and, yes, scalars.) I hate not being able to use hashes. I hate having to do the stupid book-keeping to know if I'm going to want a string or an int or a float or whatever. I know I'm not alone. Even if you don't understand it now, trust that we do and that you'll understand it very soon.
------ We are the carpenters and bricklayers of the Information Age. Don't go borrowing trouble. For programmers, this means Worry only about what you need to implement.
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|