Perl - X64bits系统和X32bits系统

时间:2016-04-18 08:18:36

标签: perl

我想问一下为什么我的脚本无法在窗口X64bits系统中工作。此脚本以前在X32bits中工作。但我不知道为什么它有“无法打开输入文件”的错误

X64bits系统中没有输出生成。

#!/usr/bin/env perl

use strict;
use warnings 'all';

my $directory = 'D:/Script_Code/Perl/Test/Datalog/Unit_80';

my $testna = 'FW OTP Check UVLO VIN Voltage';
my $testpin = 'vrect';
my $testnb = 'FW OTP Checksum Readback';
my $testnc = 'FW OTP Checksum Difference';
my $testnd = 'FW Checksum Pat Pin Fail Count';

my @header = ( 'Unit#', 'Test_Name', 'Pin_Name', 'Measure_Data', 'Upper_limit' );
my $format = "%-8s %-40s %-15s %-15s %-1s\n";
my $outfile = "$directory.sdc";

open (OUT, ">$outfile" );
open (INF, "$directory") || die (" can not open input file \n" );

printf $format, @header;
printf OUT $format, @header;

while ( <INF> ) {

if ( /Device#:\s*(\d+)/ )
{   $unit = $1;
    next;    }

chomp;

my @fields = split /\s{2,}/;

if ( $fields[2] eq $testna and $fields[3] eq $testpin ) {             # TEMP_SENSE_VBE
    printf $format, $unit, $fields[2], $fields[3], $fields[5];
    printf OUT $format, $unit, $fields[2], $fields[3], $fields[5];
}
if ( $fields[2] eq $testnb ) {             # TEMP_SENSE_VBE
    printf $format, $unit, $fields[2], $fields[3], $fields[5];
    printf OUT $format, $unit, $fields[2], $fields[3], $fields[5];
}
if ( $fields[2] eq $testnc ) {             # TEMP_SENSE_VBE
    printf $format, $unit, $fields[2], $fields[3], $fields[5], $fields[6];
    printf OUT $format, $unit, $fields[2], $fields[3], $fields[5], $fields[6];
}
if ( $fields[2] eq $testnd ) {             # TEMP_SENSE_VBE
    printf $format, $unit, $fields[2], $fields[3], $fields[5], $fields[6];
    printf OUT $format, $unit, $fields[2], $fields[3], $fields[5], $fields[6];
}

}
      close (INF) || die "cannot close input file !!";
      close (OUT);

1 个答案:

答案 0 :(得分:0)

这与Perl构建,操作系统构建或系统的体系结构无关。

首先检查你得到了什么错误!

open (OUT, ">", $outfile)
   or die("Can't create \"$outfile\": $!\n");
open (INF, "<", $directory)
   or die("Can't open \"$directory\": $!\n");