in reply to Better ways to make multi-line comments in Perl?

Also possible - but rude - is to put just a while(0) {} around it :)
  • Comment on Re: Better ways to make multi-line comments in Perl?

Replies are listed 'Best First'.
Re: Answer: Better ways to make multi-line comments in Perl?
by Abigail-II (Bishop) on Mar 24, 2004 at 12:19 UTC
    Also possible - but rude - is to put just a while(0) {} around it.
    That will only work if what you comment 1) compiles and 2) doesn't contain any compile time effects (like BEGIN, 'use' or a subrouting declaration).
    #!/usr/bin/perl use strict; use warnings; while (0) { sub foo {print "Hello, world\n"} } foo () if defined &foo; __END__ Hello, world

    Abigail