>OK: here's a dequote_like solution that solves it--the additional soluti<SNIP>
>terminators allowing leading/trailing white space.  Which is what I sugg<SNIP>
>perl5, but would require shoving "POEM" to the left margin and ensuring <SNIP>
>dequote Tom posted, with minor changes, and is given below.  Maybe Tom c<SNIP>
>improvement over "dequote".  Clearly they could coexist, people could us<SNIP>

>sub dequote_like {
>  local $_ = shift;
>  my ($leader);  # common white space and common leading string
>  if (/^\s*(?:([^\w\s]+).*\n)(?:\s*\1.*\n)+$/) {
>    $leader = quotemeta($1);
>  } else {
>    $leader = '';
>  }
>  s/^\s*$leader//gm;
>  return $_;
>}

>   { { { { {
>             if( $is_fitting && $is_just ) {
>                die dequote_like('!', <<POEM);
>                !    The old lie
>                !  Dulce et decorum est
>                !      Pro patria mori.
>                POEM
>             } # this } had been omitted
>   } } } } }


I am certainly in strong favor of a simple and visually distinctive 
solution, and find that the leading bit helps a lot.  But I would probably
have written that as:

    die <<POEM =~ /[^!]*/g;
    !    The old lie
    !  Dulce et decorum est
    !      Pro patria mori.
    POEM

save for the whitespace on "   POEM".

--tom

Reply via email to