L
Len
Hi
I am a newbie so be kind The code below is used to process the data
below it. The code works fine on some larger data of identical (I
believe) format, however on this small data it throws the error:
"Use of uninitialized value in join or string at report13a.txt line
16, <> line 7"
Any help would be great - I'm sure it's something easy but it's
driving me crazy...
Thanks
Len
----------
#! perl -w
use strict;
my ($line, @fields, $refdes, @symbol, $count);
$refdes = "NEW"; #refdes enables symbol count
$symbol[0] = "EMPTY";
while ($line = <>){
chomp($line);
next if $line =~ /(^A|^J|MECHANICAL)/; #drop out if begins with A or
J or includes Mechanical
@fields = split /!/, $line; #Change separator
if (($refdes eq "new")||($fields[1] ne $refdes)){ #New refdes
$count = 0; #Reset counter
print "$refdes array issymbol\n"; #Print previous refdes symbol
array
$refdes = $fields[1]; #Reset refdes
@symbol = (); #Reset symbol array
$symbol[0] = $fields[2]; #Put symbol name at front of array
}
else{
$count++;
$symbol[$count] = $fields[4];
}
}
print "Final $refdes array is: @symbol\n"; #Print final symbol array
-------------
A!REFDES!SYM_NAME!GRAPHIC_DATA_7!
J!C:\PCB_DATA_DUMP\test.brd!Mon Jan 31 12:46:35
2005!-75.000!-170.000!425.000!190.000!0.001!millimeters!TOP_LEVEL!31.496063
mil!2!UP TO DATE!
S!CN5!MTG_2_40CP1_70!used:01BAiss2/USB programmer!
S!CN5!MTG_2_40CP1_70!rev:1,NJH,28/09/04!
S!CN5!MTG_2_40CP1_70!1.700!
S!CN5!MTG_2_40CP1_70!2.400!
S!CN6!CONN_UMP_3MM_SMT!PACKAGE!sym.req:0554!
S!CN6!CONN_UMP_3MM_SMT!PACKAGE!lib.name:conn_ump_3mm_smt!
S!CN6!CONN_UMP_3MM_SMT!PACKAGE!height:3.00mm!
S!CN6!CONN_UMP_3MM_SMT!PACKAGE!used:01ATiss1/Whitney RF!
S!CN6!CONN_UMP_3MM_SMT!PACKAGE!rev:2,NJH,26/05/04!
--------------
I am a newbie so be kind The code below is used to process the data
below it. The code works fine on some larger data of identical (I
believe) format, however on this small data it throws the error:
"Use of uninitialized value in join or string at report13a.txt line
16, <> line 7"
Any help would be great - I'm sure it's something easy but it's
driving me crazy...
Thanks
Len
----------
#! perl -w
use strict;
my ($line, @fields, $refdes, @symbol, $count);
$refdes = "NEW"; #refdes enables symbol count
$symbol[0] = "EMPTY";
while ($line = <>){
chomp($line);
next if $line =~ /(^A|^J|MECHANICAL)/; #drop out if begins with A or
J or includes Mechanical
@fields = split /!/, $line; #Change separator
if (($refdes eq "new")||($fields[1] ne $refdes)){ #New refdes
$count = 0; #Reset counter
print "$refdes array issymbol\n"; #Print previous refdes symbol
array
$refdes = $fields[1]; #Reset refdes
@symbol = (); #Reset symbol array
$symbol[0] = $fields[2]; #Put symbol name at front of array
}
else{
$count++;
$symbol[$count] = $fields[4];
}
}
print "Final $refdes array is: @symbol\n"; #Print final symbol array
-------------
A!REFDES!SYM_NAME!GRAPHIC_DATA_7!
J!C:\PCB_DATA_DUMP\test.brd!Mon Jan 31 12:46:35
2005!-75.000!-170.000!425.000!190.000!0.001!millimeters!TOP_LEVEL!31.496063
mil!2!UP TO DATE!
S!CN5!MTG_2_40CP1_70!used:01BAiss2/USB programmer!
S!CN5!MTG_2_40CP1_70!rev:1,NJH,28/09/04!
S!CN5!MTG_2_40CP1_70!1.700!
S!CN5!MTG_2_40CP1_70!2.400!
S!CN6!CONN_UMP_3MM_SMT!PACKAGE!sym.req:0554!
S!CN6!CONN_UMP_3MM_SMT!PACKAGE!lib.name:conn_ump_3mm_smt!
S!CN6!CONN_UMP_3MM_SMT!PACKAGE!height:3.00mm!
S!CN6!CONN_UMP_3MM_SMT!PACKAGE!used:01ATiss1/Whitney RF!
S!CN6!CONN_UMP_3MM_SMT!PACKAGE!rev:2,NJH,26/05/04!
--------------