[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: ls -v in Perl
On Tue, Jun 13, 2006 at 01:52:26PM -0400, Matt Hansen wrote:
> I have a bunch of files in a directory with names like
> test1-vacuum.txt, test2-oxygen.txt, test3-argon.txt, ...,
> test10-nitrogen.txt. I'd like to open these files and manipulate them
> in the order of the number in the file names - basically, I need to
> duplicate the 'ls -v' command. Is there a way to do this, either by
> calling ls or through some internal Perl command? Thanks,
>
I believe the functions you are looking for are:
opendir
readdir
closedir
This should get you started:
http://perldoc.perl.org/functions/opendir.html
You will have to do the sorting yourself though, I don't believe that
readdir() returns the entries in any particular order.
--
Jon
X(7x): A program for managing terminals. See also screen(1).
To the NSA: Why haven't you looked at my job application yet?