[問題] use of uninitialized ....

作者: hyffdmy (ㄚ保)   2013-04-27 12:37:36
Hi ,
程式碼如下, 會有類似這樣的錯誤
mod_spice_bulk_cut.pl tcbn28lpbwp12t30p140_141a.spi > 2
Use of uninitialized value in concatenation (.) or string at
/array9/ip/ip00_15/ip00_15j/test_perl/mod_spice_bulk_cut.pl line 27, <FILE>
line 3.
Use of uninitialized value in concatenation (.) or string at
/array9/ip/ip00_15/ip00_15j/test_perl/mod_spice_bulk_cut.pl line 27, <FILE>
line 4.
Use of uninitialized value in concatenation (.) or string at
/array9/ip/ip00_15/ip00_15j/test_perl/mod_spice_bulk_cut.pl line 27, <FILE>
line 5.
Use of uninitialized value in concatenation (.) or string at
/array9/ip/ip00_15/ip00_15j/test_perl/mod_spice_bulk_cut.pl line 27, <FILE>
line 6.
然後 這是我的輸入檔案的字串
.subckt LVLLH I Z VDD VDDL VSS
MM15 net46 I VSS VSS nch_mac l=30n w=4n m=1
MM10 net64 net57 VSS VSS nch_mac l=30n w=4n m=1
MM5 Z net46 VSS VSS nch_mac l=30n w=4n m=8
MM2 net57 I VSS VSS nch_mac l=30n w=4n m=1
MM14 net57 I VDDL VDDL pch_mac l=30n w=52.0n m=1
MM4 Z net46 VDD VDD pch_mac l=30n w=52.0n m=8
MM6 net49 net64 VDD VDD pch_mac l=30n w=20.0n m=3
MM17 net46 I net49 VDD pch_mac l=30n w=20.0n m=3
MM9 net44 net46 VDD VDD pch_mac l=30n w=20.0n m=3
MM16 net64 net57 net44 VDD pch_mac l=30n w=15.00n m=1
.ends
#!/usr/bin/perl -w
use strict;
open FILE, "<$ARGV[0]";
open FILEX, ">$ARGV[0].mod";
my $tmp;
while(<FILE>)
{
if ($_ =~ /^\.subckt\s+(.*)/ || $_ =~ /^\.SUBCKT/)
{
print FILEX ".subckt $1 VPP VBB\n";
}
# elsif ($_ =~ /^M(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(.*)/ &&
$_ =~ /pch/)
# {
## $_ =~ s/ VDD pch/ VPP pch/;
# print FILEX $_;
# }
elsif ($_ =~ /(\w+) (.*) VSS VSS (.*)/ && $_ =~ /nch/)
{
print "$1\n";
# print FILEX "$1 $3\n";
}
else
{
print FILEX $_;
}
}
請問一下 為什麼該行的$1 $3會有這樣的問題???
而且吐出的字串是空的
Thanks./
作者: abliou (愚者)   2013-04-27 14:29:00
錯誤還警告?你用-w會有警告是正常的吧
作者: hyffdmy (ㄚ保)   2013-04-27 15:13:00
sorry 重點不是警告 是字串沒有吐出來 我覺得還滿奇怪的..
作者: CindyLinz (Cindy Wang)   2013-04-27 18:00:00
你那個 && 後面也是 regex, 它跑下去就會把 $1,$3 蓋掉

Links booklink

Contact Us: admin [ a t ] ucptt.com