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.
  • It may not be pretty, but it does make reading the code much easier.

    }) %]"> enables the reader to extract information that the single-delimiter style ))))) cannot provide. I think that ))))) is prettier, but less practical.

    } is the end of a hash
    ) is probably the end of a function call
    %] is the end of a TT directive
    " is the end of text; the following > tells us it's an SGML-ish attribute value
    > is the end of an SGML-ish tag
    • I think that ))))) is prettier, but less practical.

      Funny you say that, ‘cause I was just thinking the same about sigils today. Yeah sure, they’re noisy and can gunk up the code – also, they’re extra red tape that needs to be typed over and over. But they make it so much easier to scan the code! Consider something like this:

      10 * $bar * log( $foo + 2 + cos( $baz ) )

      You can immediately tell apart the “slots” where variable values go, the static pieces, and the function calls, even if without consciously reading the code. Sure, it’s uglier than this:

      10 * bar * log( foo + 2 + cos( baz ) )

      But the sigil-laden version is definitely easier to scan. In fact, now that I’m laying them out side by side like this, the difference is striking.

      I like sigils. Not pretty. But convenient.

      • I had that side-by-side experience when changing the javascript on [] to a more perl-like style. Another huge advantage of sigils is that you can use variable interpolation - that's the rare occasion where sigils are prettier than the alternative, lots of concatenated string literals.
      • I happen to think convenience is pretty.

        J. David works really hard, has a passion for writing good software, and knows many of the world's best Perl programmers