open(DAT, $data_file) || die("Could not open file!"); @raw_data=; $int=0; #calculating the number of gates: $mystring = @raw_data; while($mystring =~ m/(\d+)/g) { print "\r\n"; $lines= $1; $lines= $lines-2; } print "The number of gates is " . $lines ; print "\r\n"; $linez=$lines+2; #calculating the number of nets: #max is the number of nets $a=0; while($a<=$linez) { $mystring= @raw_data[$a]; while($mystring =~ m/(\d+)/g) { print "$1 \n"; push(@array1, $1); } print "\r\n"; my $max = max(@array1); push(@netsize, $max); $a++; } my $max = max(@netsize); print "\r\n"; #initializing the nets to 2 $n=0; while ($n<=$max-1) { @net[$n]=2; $n++ } print "The net array is @net \r\n"; print "Please enter the input vectors"; #The number of inputs $z=0; $mystring = @raw_data[-2]; while($mystring =~ m/(\d+)/g) { print "\r\n"; $z++; } $z--; print "The number of inputs are $z \r\n"; print "The number of gates is $lines \r\n"; print "The number of nets are $max \r\n"; print "The number of gates are $lines \r\n"; print "Enter the inputs \r\n"; #Getting the value of the gates: $mystring= @raw_data[-2]; while($mystring =~ m/(\d+)/g) { print "Enter the vector for input $1 \r\n"; $ip = ; @net[$1-1]=$ip; } print "\r\n"; print "@net[2] \r\n"; #pushing the gates in the array: $b=0; $a=0; while($a!=$lines) { $mystring = @raw_data[$a]; if($mystring =~ /\A(.*?) /) { print "The gate is $1"; print "\r\n"; @gate[$b]=$1; $b++; } $a++; } join(",",@gate); join(",",@net); print "The net array is @net \r\n"; print "The gate array is @gate \r\n";