Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • Yes there are more annoyances. From the top of my head:
    • Very inconsequent in naming the built-in functions. Sometimes, there's underscores between the word parts, sometimes they're just concatenated. There's no fixed rules for the word part orders. Sometimes, related/similar functions have vastly different names: strtolower(), strtoupper(), ucfirst(), ucwords(), mb_strtolower().
    • Some keywords require parens, while others can do without: for example:
      echo "foo";
      works without problem, but you do need the parens in
    • and the well know age old "there's no variable scoping, apart from function level scoping" complaint. If only file-level scoping was supported, I'd already be a much happier man. Now, if you do
      foreach($array as $id) {
      at the top level, your global $id will have been cluttered.
    And there's zillions more...
    There seems no way (at this part of the book) to distinguish the difference between a scalar and an array. They both use the $ sigil.(page 27)
    You should think of it as the array and the array ref being equivalent. You cant have both a $foo and a @foo as both are the same variable: $foo.

    In addition, treating a string as an array results in characters being picked out of the string, like Perl's substr. Well, almost:

    $x = "foobar";
    $x[3] = "XYZ";
    echo $x;
    prints "fooXar".
    There is an array() function. (page 27)
    Yes, and there's no "[ ... ]" shortcut, like in Javascript. (And in Perl.)
    There is more than one sort function. (page 28)
    Yes, and the array_multisort() [] is nothing short of a nightmare. The API is very difficult, every column is a separate array, and there's no way to have it sort on a variable number of columns. Just give me the unified and very powerful sort BLOCK LIST from Perl, any day.