in reply to Problem with awk

How about dropping the calls to ls and gawk, and getting the list of files to iterate over in Perl?

opendir DH, '.' or die "Couldn't open dir: $!" ; my @files = sort { $a cmp $b } map { ( split /\./ )[0] } grep { /\.pdl$/ } readdir DH ; close DH ;

_______________
DamnDirtyApe
Those who know that they are profound strive for clarity. Those who
would like to seem profound to the crowd strive for obscurity.
            --Friedrich Nietzsche

Replies are listed 'Best First'.
Re^2: Problem with awk
by Aristotle (Chancellor) on Aug 14, 2002 at 21:11 UTC
    Or maybe even
    opendir DH, '.' or die "Couldn't open dir: $!" ; my @files = sort { $a cmp $b } map /^([^.]*).*\.pdl$/, readdir DH ; close DH;
    Non-matches automatically disappear from the results of a map /(reg)ex/, @list

    Makeshifts last the longest.