sub addMyFile{ my $file = shift; #this is the filename of the file i am adding my $fullpath = "$edmdir\\$file"; #full filename with path my $addpres = $ppt->Presentations->Open( $fullpath ) or die "Can't open PowerPoint file '$fullpath': $!\n"; my @slides; my $j = 1; my $slide; while ($addpres->Slides($j)){$slides[$j] = $addpres->Slides($j);$j++}; shift(@slides); #because I start at 1, i need to drop off the first element. my $m; my $k = 0; foreach (@slides){ $m = $k+1; #because slide index starts at 1, not 0; $addpres->Slides($m)->Copy; #copy newly opened file slide... $pres->Slides->Paste($slideIndex); #past it into current presentation. $slideIndex++; $k++; } }