Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: making my script work with vi

by Paladin (Vicar)
on Jul 15, 2004 at 18:13 UTC ( [id://374764] : note . print w/replies, xml ) Need Help??


in reply to making my script work with vi

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:
#!/usr/bin/perl -w use strict; while (<STDIN>) { chomp; if ( ! -e ) { print "#$_\n"; } else { print "$_\n"; } }