Plankton has asked for the wisdom of the Perl Monks concerning the following question:
Friends,
I am trying to write a simple script that I could use while editting files with vi. One of the things I like about vi is that you can do things like :1,$ !program. Here's a demostration of what I want to be able to do ...
I am trying to write a simple script that I could use while editting files with vi. One of the things I like about vi is that you can do things like :1,$ !program. Here's a demostration of what I want to be able to do ...
In the above example I used sort to modify my file. I want to be able to do this with this script ...bash-2.05b$ vi junk NOTES doc backup notes scripts cpio_out bashrc ~ ~ ~ :1,$ !sort backup bashrc cpio_out doc notes NOTES scripts :wq
... but when I do something like this ...bash-2.05b$ cat twc #!/usr/bin/perl -w use strict; my $file = shift; if ( !defined( $file ) ) { print "usage: $0 <dir|file>\n"; exit 0; } if ( ! -e $file ) { print "#$file\n"; } else { print "$file\n"; }
... I get this ...bash-2.05b$ vi junk backup bashrc cpio_out doc notes NOTES scripts ~ ~ ~ :1,$ !./twc
How should I be handling the input in my Perl script?usage: ./twc <dir|file>
Plankton: 1% Evil, 99% Hot Gas. |
Back to
Seekers of Perl Wisdom