#!C:\Perl\bin
#excel::writer attempt
#allows IR-Serial-Parts tracking
use strict;
use warnings;
use POSIX qw(strftime);
use Excel::Writer::XLSX;
use Spreadsheet::WriteExcel;
my $ref = strftime '%Y-%m-%d', localtime(); #create the datestamp
my $workbook;
my $worksheet;
my $i = 1;
my $ir = "IR Number: ";
my $sr = "UUT Serial: ";
my $pur = "How many parts used: ";
my $part = "Scan Part: ";
my @parts = "";
if(-e 'tracking.xlsx'){
my $workbook = Spreadsheet::WriteExcel->open('tracking.xlsx'); #open existing excel file
}
else{
my $workbook = Excel::Writer::XLSX->new('tracking.xlsx'); #open new Excel if the date on comp has changed
}
$worksheet = $workbook->add_worksheet($ref);
print $ir; #ask user for IR #
my $irs = <>; #get user IR
print $sr; #ask user for serial
my $isr = <>; #get serial from user
print $pur; #get the number of parts used that way we can run the while loop below
my $count = <>;
While ($i < $count){
print $part;
my $scan = <>;
push @parts, $scan;
$i++;
}
$worksheet->write( 'A1', '$irs');
$worksheet->write( 'A2', '$isr');
$worksheet->write( 'A3', '@parts');
这个脚本处于dev的第一阶段。我不是一个perl上帝,事实上我是全新的,但它太棒了! 当我第一次运行时,我有一些简单的错误,可以从错误消息中解决,但我似乎无法理解这一点,我觉得它应该比我之前的错误更容易修复任何帮助解释为什么这个正在发生的事情真棒!
syntax error at writexcel.pl line 39, near "){"
syntax error at writexcel.pl line 45, near "}"
Execution of writexcel.pl aborted due to compilation errors.
Press any key to continue . . .
答案 0 :(得分:0)
由于@ThisSuitIsBlackNot指出我的while循环中的while
是capaptilized并且需要是小写的。谢谢你的快速回复!