Yes, I have noticed that there are many similarities between Perl and JavaScript...the way they handle numbers for example. A variable scalar can hold a string or number, and what you do with it or how you treat it is going to determine whether it's going to be used as a number or a string. Both Perl and JavaScript has the ? : << >> / + - + -- ++ *= /= %= -= += <<= >>= operators. In JavaScript the % modulo operator works a bit differently, but both Perl and JavaScript stores numbers the same way. In JavaScript, you can use arguments[] just like in Perl you can use @_ but in Perl they did away with named arguments. Both JavaScript and Perl have regexes, although JavaScript is a bit limited. When it comes to Unicode characters, Perl requires a module to work with unicode strings, but in JavaScript the support is builtin from the start. In fact, your JavaScript functions and variable names can have unicode characters in them. In JavaScript, you can name your variables to start with a $ sign and write code that resembles Perl. Both Perl and Javascript have the eval function. Perl has "last" and "next," while JavaScript has "break" and "continue." They do the exact same thing. Both Perl and Javascript are quite lenient in the way they parse the source code (unless you use strict and warnings).
Perl has vec(), pack() and unpack() and printf() and sprintf() which are entirely missing from JavaScript. Perl is very efficient at manipulating strings but not so fast working with arrays. JavaScript is just the opposite. It's very fast with arrays but slow with strings. Perl has hashes, while JavaScript has properties. I know, it's not the same, but it's a little bit similar.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.