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.
  • have you ever seen this sort of thing in an API where a positive value in a parameter means one thing and negative value means something very different?
    I can give you two examples in Perl.
    1. (s)sprintf templates, "%10s" vs. "%-10s"... where one means align to the left, the other, align to the right.
    2. substr, where negative numbers for a numerical parameter mean from the end. In particular, check out the third parameter, LENGTH, which is not a length but the end offset (from the end) if it's negative.
      $s = join "", "A" .. "Z";
      print substr($s, 10, -10);