#!/usr/bin/perl -w use strict; use Win32::OLE; #or ParseExcel or whatever my $DEBUG = 1; # # Subroutines # sub get_cell_val() { my ($src_sheet, $src_row, $src_col) = @_; if (defined $src_sheet->{Cells}[$src_row][$src_col]) { $_ = $src_sheet->{Cells}[$src_row][$src_col]->Value; } else { $_ = ''; } } # # Main Program # sub ret_files { my ($path)=@_; chdir($path) or die "Cannot change path: $!"; return(glob('*.xls')); } sub main { #... the rest of your code }# end of main 1; #### C:\Temp>perl -e "require 'crow.pl'; print map{qq|$_\n|} ret_files('.');" > do.dat #### perl -ne "BEGIN{require 'crow.pl'}; main($_)" do.dat