in reply to Writing unix-style filters
If you don't wanna read from the files on the command line, why are you using <>?
#!/usr/bin/perl # usage: # myscript *.txt # myscript `ls *.txt` # ls *.txt | myscript use strict; use warnings; my @files = @ARGV; if (!-t STDIN) { while (<STDIN>) { chomp; push @files, $_; } } ...
But do you really need this whole STDIN thing?
#!/usr/bin/perl # usage: # myscript *.txt # myscript `ls *.txt` use strict; use warnings; my @files = @ARGV; ...
I must agree on the previously stated point that this is not how unix filters work.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Writing unix-style filters
by njcodewarrior (Pilgrim) on Apr 11, 2007 at 23:38 UTC | |
by ikegami (Patriarch) on Apr 12, 2007 at 01:26 UTC |