Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
use Spreadsheet::ParseExcel; use File::Find; use File::Copy; my $oBook = Spreadsheet::ParseExcel::Workbook->Parse('regions.xls'); my($iR, $iC, $oWkS, $oWkC); my $dir = "D:\schema"; #for mapped drives give \\ and for local drives + \ my $currentdir = $ARGV[0]; my @inputarray = (); my $count = -1; foreach my $oWkS (@{$oBook->{Worksheet}}) { for(my $iR = $oWkS->{MinRow} ; defined $oWkS->{MaxRow} && $iR <= $ +oWkS->{MaxRow} ; $iR++) { for(my $iC = $oWkS->{MinCol} ;defined $oWkS->{MaxCol} +&& $iC <= $oWkS->{MaxCol} ; $iC++) { $oWkC = $oWkS->{Cells}[$iR][$iC]; push(@inputarray,$oWkC->Value); } } } while ($#inputarray > 0) { find({ wanted => \&edits}, $dir); } sub edits() { if ( -f and /.xml?/ and $#inputarray >= 0) { $file = $_; print $#inputarray; foreach $input(@inputarray) { $count++; if ($#inputarray < 0) { print "Input array empty"; last; } if ($file =~ $input) { @newarraypreceding = splice (@inputarray,0 +,$count-1); @newarrayfollowing = splice (@inputarray,$ +count+1); @inputarray = (@newarraypreceding , @newar +rayfollowing); print $input; print " popped out $input fr +om array"; copy($file, $currentdir//$file) or die "Fi +le cannot be copied."; print "Array count : $#inputarray"; } } } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: recursive loop and performace issue in find::file
by Ratazong (Monsignor) on Apr 26, 2011 at 11:45 UTC | |
by Limbic~Region (Chancellor) on Apr 26, 2011 at 18:51 UTC | |
by Ratazong (Monsignor) on Apr 27, 2011 at 06:58 UTC | |
|
Re: recursive loop and performace issue in find::file
by moritz (Cardinal) on Apr 26, 2011 at 11:57 UTC | |
|
Re: recursive loop and performace issue in find::file
by raybies (Chaplain) on Apr 26, 2011 at 12:00 UTC |