steveb94553 has asked for the wisdom of the Perl Monks concerning the following question:
#Delete current temp_sym_pn.txt if exists. `del temp_ref_list.txt`; { open(brdpartlog, "brd_sym_pn.txt") || die("failed to open br +d_sym_pn.txt"); print "\n"; while($line = <brdpartlog>) { @fields = split(/\t/,$line); # if($fields[1] eq $Pnum) { our $RdesPnPkg = "$fields[0]\t$fields[1]\t$fields[2] +"; our $RdesPn = "\"$fields[0]\"\t\=>\t\"$fields[1]\", +"; our $BrdPnPkg = "$fields[1]\t$fields[2]"; our $RefDes = "$fields[0]"; our $Pnum = "$fields[1]"; our $Pkg_Type = "$fields[2]"; } %hash_ref_pn = ($RefDes, $Pnum); my @k = keys %hash_ref_pn; my @v = values %hash_ref_pn; print $k[0] ,"\t", $v[0], "\n"; # I thought this would assign $k to key in %hash_ +ref_pn # and would print each Key (reference designator) $k[0] = $Rf_Ds; print $Rf_Ds; # I thought this would assign $v to key in %hash_ +ref_pn # and would print each Key (Part_Number) $v = $Part_Number; print $Part_Number; #prints value (12-0259-01) of key J2 #print ($hash_ref_pn{J2}); #counts the number of keys included in %hash_ref +_pn my $count = keys %hash_ref_pn; #print $count; #print "\n"; #creates a string that resembles an associative hash #of reference designators #example: "J2" => "12-0259-01", "P1" => "12 +-0258-01", #Prints each reference designators on one line. #@RdesList=(); #@RdesList=($RefDes); open(Ref_List, ">>temp_ref_hash.txt"); print Ref_List "$RdesPn\t"; close(Ref_List); } open(Ref_List, "temp_ref_hash.txt"); @lines = <Ref_List>; $lines = $Pnum; close(Ref_List); #print @lines; my %hash_ref_pn = <Ref_List>; print ($hash_ref_pn{"J1"}); print "\n"; #print ("xxxxxxxxxx\n" x 3); print "$Pnum was the last assigned \$Pnum"; #Type out temp_ref_list.txt to screen, DOES NOT WORK??? #`Type c:\\work\\academy_x\\log_pn_check\\temp_ref_list.txt`; #exit; print "\n"; open(brdpartlog, "brd_sym_pn.txt") || die("failed to open br +d_sym_pn.txt"); print "\n"; while($line = <brdpartlog>) { @fields = split(/\t/,$line); if($fields[1] eq $Pnum) { our $RdesPnPkg = "$fields[0]\t$fields[1]\t$fields[2] +"; our $BrdPnPkg = "$fields[1]\t$fields[2]"; our $RefDes = "$fields[0]"; our $Pnum = "$fields[1]"; if($BrdPnPkg eq $LogPnPkg) { print("$RefDes\t$BrdPnPkg is the correct Allegro footp +rint.\n"); } else { print("$RefDes\t$BrdPnPkg should be using $LogPkg_Type +\n"); } } } open(partlog, "sym_text_latest.txt") || die("failed to open sym_ +text_latest.txt"); while($line = <partlog>) { @fields = split(/\t/,$line); if($fields[0] eq $Pnum) { our $LogPnPkg = "$fields[0]\t$fields[4]"; our $LogPnum = "$fields[0]"; our $LogPkg_Type = "$fields[4]"; } } }
|
|---|