use Win32::OLE qw(in); use Win32::OLE::Const 'Microsoft Word'; sub print_tables { my $word =Win32::OLE->new('Word.Application','Quit'); # shift; my $word_file = file(abs_path(shift)); my $doc = $word->{Documents}->Open("$word_file"); my $tables = $word->ActiveDocument->{Tables}; for my $table (in $tables) { my $numrows=$table->Rows->Count; my $rownum=1; while($rownum<=$table->Rows->Count){ ... $main::numcols=$table->Columns->Count; my $cell5=$table->Cell($rownum,$main::numcols);#this is the last column ..... } } }