in reply to Re: Array problem......PLEASE HELP!
in thread Array problem......PLEASE HELP!

Hi there, I dont want to join 08 and 09 files together. At the first loop i need the 08 files where i will process only files and gererate a report. At the second loop i require the 09 files and output a report.

Replies are listed 'Best First'.
Re^3: Array problem......PLEASE HELP!
by zentara (Cardinal) on Jan 05, 2009 at 22:35 UTC
    Try this:
    #!/usr/bin/perl use warnings; use strict; use Data::Dumper; opendir(DIR, '.'); my @files = grep !/^\.{1,2}$/, readdir DIR; my @files8 = grep /08/, @files; my @files9 = grep /09/, @files; closedir DIR; print "@files\n"; my %commands; #maybe use a hash print "08 files\n"; foreach my $file (@files8){ $commands{'08'}{$file} = `ls -l|grep $file` } print "09 files\n"; foreach my $file (@files9){ $commands{'09'}{$file} = `ls -l|grep $file` } print Dumper([\%commands]);

    I'm not really a human, but I play one on earth Remember How Lucky You Are