#!/usr/bin/perl5.10 -w
use warnings;
use Spreadsheet::WriteExcel::Big;
use Spreadsheet::ParseExcel;
use strict;
use IO::Scalar;
use Data::Dumper;
my $new_parser = Spreadsheet::ParseExcel->new();
my $new_workbook = $new_parser->parse("/ms/user/s/sayantag/Source.xls");
my $new_worksheet = $new_workbook->Worksheet("Drivers");
my $calc = shift;
for $new_worksheet ( $new_workbook->worksheets("Drivers") ) {
my ( $row_min, $row_max ) = $new_worksheet->row_range();
my ( $col_min, $col_max ) = $new_worksheet->col_range();
for my $row ( $row_min .. $row_max ) {##First for##
for my $col ( $col_min .. $col_max ) {##Second for##
my $cell = $new_worksheet->get_cell( $row, $col );
if ($col==0 && $row !=0 && ($new_worksheet->get_cell($row, 0)->value =~ /($calc)/)) {
$col++;
my $serv = $new_worksheet->get_cell($row, $col)->value;
print "\nPls login to the server : $serv\n";
$col++;
my $path = $new_worksheet->get_cell($row, $col)->value;
my $path1 = $serv . $path;
chdir($path1);
$col++;
my $cmd = $new_worksheet->get_cell($row, $col)->value;
`$cmd`;
}
}
}
}
|