William <> wrote:
> Subject: system calls (mv + grep) within Perl script
There is no "mv" anywhere in your article.
It there had been, then I would have pointed you to:
perldoc rename
but you didn't, so I won't.
> #!/usr/bin/perl -w
Lexical warnings are much better than global warnings, so you should
enable warnings this way instead:
use warnings;
> open ( DUMMY_FD, $dummy_list ) || die "Cannot open file $dummy_list\n";
You should include the _reason_ for the failure in your message.
It is also a good idea to put delimiters around the failed filename:
open ( DUMMY_FD, $dummy_list ) || die "Cannot open file '$dummy_list' $!";
> my @lines = <DUMMY_FD>;
> close ( DUMMY_FD );
> foreach my $currentLine ( @lines ) {
Don't read the entire file into an array if all you plan to do is
process it line-by-line anyway.
Simply read it line-by-line in the first place:
while ( my $currentLine = <DUMMY_FD> ) {
> ($start, $ticker, $bo_fo_eligible, $lfo_eligible) = ( split(/\|/,
> $currentLine) );
> system "grep ''$ticker' $originalList' >> $requiredList";
^^
^^ you have messed up the quoting
--
Tad McClellan SGML consulting
Perl programming
Fort Worth, Texas