http://qs321.pair.com?node_id=374768


in reply to making my script work with vi

As you can learn from your example with sort, the external command takes your lines from the standard input.

Change your script this way:

#!/usr/bin/perl -w use strict; while (<>) { chomp; print "file is [$_]\n"; if ( ! -e $_ ) { print "#$_\n"; } else { print "$_\n"; } }

However, if your Vim has direct Perl support, you can execute something like this:

:1,$ perldo s/^/#/ unless -e $_

See Editing features for advanced users for an explanation and more examples on similar features.

 _  _ _  _  
(_|| | |(_|><
 _|