in reply to system call in Perl

The direct question has been answered (use the "q" operator), but as for the other question that has been hinted at, you could use perl to do some or all of what your system call is doing:
# use an all-perl approach: opendir( DIR, "." ); @files = sort {$b cmp $a} grep /BC.*?\.txt$/, readdir DIR; close DIR; open( OUT, ">BCfile.name" ); for ( grep !/Liver/, @files ) { s/\..*/\n/; print OUT; } close OUT; # OR... a little bit of reliance on a sub-shell is okay too; # the next four lines do the same thing just as well: @files = map {s/\..*//; $_} grep !/Liver/, `ls -r *BC*.txt`; open OUT, ">BCfile.name"; print OUT join "", @files; close OUT;
And of course, an all-command-line solution could be made easier by avoiding "awk":
ls -r *BC*.txt | grep -v Liver | cut -f1 -d. > BCfile.name
(Look Ma! No quotes!)

Replies are listed 'Best First'.
Re: Re: system call in Perl
by blue_cowdawg (Monsignor) on Jul 11, 2003 at 15:38 UTC

    Just to add to this: not only do you get rid of the quotes but it will probably work faster.


    Peter L. BergholdBrewer of Belgian Ales
    Peter@Berghold.Netwww.berghold.net
    Unix Professional