This is a perl philosophy question. I need to look for
some files, newest first. If I use the glob directive in perl, I
can fill an array with all the file names that match the pattern
but they aren't sorted in to chronological order. I found a
perlmonks posting in which the same question was asked and the
suggestion was to use something like

@files = `ls -t filenames*`

Which, to me, is a perfectly good solution in the unix world. It
probably isn't portable to, say, Windows but it doesn't need to
be in this case.

        I have read perl instructional documentation that warns
about using system("commands") and shell commands so my question
is, what is wrong with that?

        The only thing I can see is that it is not portable and
that since the commands are outside of perl, the results might
change one day. It probably also takes extra CPU cycles but
unless one is doing DSP, who's counting?

        Thanks.

Martin McCormick

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to