in reply to REALLY PERL ??

One technique I sometimes use to comment out a bunch of Perl lines is to put in some temporary POD directives. =Any header..lines...=cut Start the "=" in column 1. Perl figures that the included lines are "Plain Old Documentation" and Perl doesn't compile them. C has a multi-line comment syntax. Perl doesn't, but this is a good substitute.

I also recommend just moving an __END__ statement around in the code.

Everybody here has had some kind of syntax problem that at one time stumped them for awhile. This is a normal part of software development. I would argue to anybody who claims that has never happened: a) you are lying or b) you don't have enough experience.

I think just last week, I had a really bizarre looking error that I traced back to a ":" instead of a ";" at the end of a "use" statement. It didn't take long for me to figure out the problem. But yes, an error 20 lines later can and does happen. I've seen that in every HLL that I've used.

Replies are listed 'Best First'.
Re^2: REALLY PERL ??
by kcott (Archbishop) on Aug 16, 2017 at 08:37 UTC

    G'day Marshall,

    ++ They're all good techniques which I use too. I also sometimes add a temporary exit statement: often in a loop to see print debug statements for just one iteration.

    I almost always add something like

    # TODO - debugging

    just before those things so that they're easy to subsequently find and remove. My normal syntax highlighting displays the commented "TODO" in a horribly contrasting magenta on blue so it's really hard to miss; even without that, it's easy to just search the text for.

    "... a really bizarre looking error that I traced back to a ":" instead of a ";" at the end ..."

    Unfortunately, that's one mistake I make far too often. It was very difficult to track down when I first used to make it. I now recognise it as just something I do when not releasing the Shift key quickly enough:

    $result = function(...): $hashref = { ... }: $string = "...":

    It's easy to miss when just reviewing the code because ":" and ";" look very similar; at least now it's easy to find and fix when I get a syntax error reported.

    — Ken