Perl: Send Email

A Perl sample code to send a file’s content by either Gmail or local SMTP. #!/user/bin/perl -w use strict;use Net::SMTP; # used by local SMTPuse Net::SMTP::TLS; # used by Gmail # Read the file content from error_logopen( my $error, "<error_log");my @log = <$error>;# If error_log is empty, then do nothingif (scalar(@log) == 0) {    close … Continue reading Perl: Send Email

Perl: Read Excel Cell Value

A sample code to read excel cell value by using Spreadsheet::ParseExcel module. #!/user/bin/perl -w use strict;use Spreadsheet::ParseExcel;#Parse excel filemy $parser = Spreadsheet::ParseExcel->new();my $workbook = $parser->parse("test.xls"); #Get cell value from excel sheet1 row 1 column 2my $worksheet = $workbook->worksheet('sheet1');my $cell = $worksheet->get_cell(1,2); # Print the cell value when not blankif ( defined $cell and $cell->value() ne … Continue reading Perl: Read Excel Cell Value