SPUG: multi-line substition, all at once.

Ryan Corder ryanc at greengrey.org
Thu Jun 25 00:00:43 PDT 2009


On Wed, Jun 24, 2009 at 07:48:22PM -0700, Charles DeRykus wrote:
| Er, wouldn't this work even with the added qualification:
| 
| $code = "[code]${code}[\\code]";
| $code =~ s/^ ://gm;

No, that's the same problem.  I can't just wrap the entirety of $code
inside [code] tags.  Using your example and if $code contained the following:

my $code=<<__CODE__;
foo bar
baz

 :    sub hello {
 :        say "Hello World!";
 :    }
asdf
snap
crackle
pop
__CODE__

The output would like like this:

    [code]foo bar
    baz
    
        sub hello {
            say "Hello World!";
        }
    asdf
    snap crackle
    pop
    [/code]

which doesn't work for me.  I need to insert the [code] tags on either
side of the substitution, inline with any content that may already be there.


-- 
Ryan Corder                  ||     () ASCII ribbon campaign
<ryanc at greengrey.org>     ||     /\  against HTML email
http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x1CB59D69
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <http://mail.pm.org/pipermail/spug-list/attachments/20090625/cf2a05ab/attachment.bin>


More information about the spug-list mailing list