<?xml version="1.0" encoding="windows-1252"?>
<node id="374764" title="Re: making my script work with vi" created="2004-07-15 14:13:35" updated="2005-03-18 09:01:31">
<type id="11">
note</type>
<author id="221484">
Paladin</author>
<data>
<field name="doctext">
When you use ! with vi, it sends the text to the program on STDIN, and replaces it with whatever the program outputs on STDOUT.  Try something like this:
&lt;code&gt;
#!/usr/bin/perl -w
use strict;

while (&lt;STDIN&gt;) {
    chomp;
    if ( ! -e ) {
        print  "#$_\n";
    } else {
        print "$_\n";
    }
}
&lt;/code&gt;</field>
<field name="root_node">
374750</field>
<field name="parent_node">
374750</field>
</data>
</node>
