in reply to In-place editing of files

i'll throw this in the 'alternative' pile, since i'm not sure it qualifies as 'easier'.
#!/usr/bin/perl -w { local $/ = undef; # slurp. $_ = <>; } $nb = qr/[^\}]*/; # non-close-bracket $nq = qr/[^\"]*/; # non-quote while( m/^Tag+ \s+ \{ $nb \n\s+ Name \s+ \" ($nq \s $nq) \" $nb \} /msx ) { substr( $_, $-[1], $+[1]-$-[1] ) =~ s/ /_/g; } print;
i hadn't heard of the substr() lval return trick until this thread; it's pretty useful. also hadn't heard of @- or @+ till digging around. felt i'd share.

re: earlier comment -- the $N vars are immutable, so you can't s/// them, sadly.