CnUnix

[알림판목록 I] [알림판목록 II] [글목록][이 전][다 음]
[ CnUnix ] in KIDS
글 쓴 이(By): hcsim (은행나무)
날 짜 (Date): 2002년 12월 10일 화요일 오후 05시 25분 46초
제 목(Title): Re: perl 질문입니다.


#!/bin/perl -w

if($#ARGV < 1){
 print "usage: convert inputfile outpufile\n";
}

$ifile = $ARGV[0];
$ofile = $argv[1];

open IFILE, "$ifile" or die "Cannot open $ifile\n";
open OFILE, ">$ofile" or die "Cannot open $ofile\n";

while(<IFILE>){
  chomp;
  if(/\\\S*\[/){
    ($sig,$_) =~ s/^.*\\(\S*)\[\d*\].*$/$1/;
    ($num,$_) =~ s/^.*\[(\d*)\].*$/$1/;
    if(exist $hash{$sig}){
      if($num eq "0"){
        $_ =~ s/,/\};/;
      }
    } else {
      $hash{$sig} = 1;
      print "wire [$num:0] $sig;\n";
      print "assign $sig = {\n";
    }
    print "\t\t\t$_\n";
  }
  print "$_\n";
}

close IFILE;
close OFILE;

------------------------------------------------------------------------------

프로그램을 이해하기는 힘들지만 실행해보니
Error가 발생합니다.

Useless use of a variable in void context at comb_bus.pl line 16.
Useless use of a variable in void context at comb_bus.pl line 17.
line 16, line 17
    ($sig,$_) =~ s/^.*\\(\S*)\[\d*\].*$/$1/;
    ($num,$_) =~ s/^.*\[(\d*)\].*$/$1/;

syntax error at comb_bus.pl line 18, near "$hash{"
syntax error at comb_bus.pl line 22, near "}"
Execution of comb_bus.pl aborted due to compilation errors.




[알림판목록 I] [알림판목록 II] [글 목록][이 전][다 음]
키 즈 는 열 린 사 람 들 의 모 임 입 니 다.