On Tue, May 19, 2009 at 02:03, AndrewMcHorney <andrewmchor...@cox.net> wrote: > Hello > > I think we are loosing track of what I want to do. > > I want to stay out of the dir code approach. > > I want to find all the files on a drive (C, D...) and put them into an > array. I would like access to the file size of the files so if I find 2 > files with the same name I want to compare the file size. > > My goal is to create 3 directories. The first would contain only the > directory names. The second one would have the file name (minus directory > path) and each file would have a corresponding entry that would point to the > entry in directory array for this file. A 4th array would contain the file > size. snip
You mean arrays not directories right? I would suggest against the parallel array structure and use an array of hashes like this #!/usr/bin/perl use strict; use warnings; use File::Find; my @files; find sub { return unless -f; push @files, { dir => $File::Find::dir, name => $_, size => -s }; }, "c:/"; for my $file (@files) { print "file $file->{name} is in directory $file->{dir}", "and contains $file->{size} bytes\n"; } -- Chas. Owens wonkden.net The most important skill a programmer can have is the ability to read. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/