#!/usr/bin/perl use v5.10 ; use strict; use warnings ; use Excel::Table ; use constant WORKBOOK => "d:/desktop/testWB.xlsx" ; # test if the path works open(P, "<", WORKBOOK) or die "Can't find the workbook: $!\n" ; close P ; my $xs = getWB(WORKBOOK) ; exit ; sub getWB { my ($dir, $wb) = $_[0] =~ /(.*)\/(.*)/ ; say "Directory is $dir" ; say "Excel file is $wb" ; my $xs = Excel::Table->new(dir => $dir) ; $xs->open($wb) ; return $xs ; }