open FILE, '<', "golden.rpt" or "die unable to open read file $!"; while (my $line = ) { next if $line =~ /^\s*$/; #skip blank lines next if $line =~ /#/; #Skip comments my ($netname, @referencedesignators) = split ' ', $line; #split file into a scalar for netname and put all of the reference designators into an array my @singlereference; while (@referencedesignators) { my $firstpart = shift @referencedesignators; #split array into two scalars one for the letter then number sequence and the other for the analog thing my $secondpart = shift @referencedesignators; push @singlereference, "$firstpart $secondpart"; #push these two scalars to form a pair. Each pair is one reference designator. These pairs form an array. } @singlereference = sort {$a <=> $b} @singlereference; #sort by ascending foreach my $col (@singlereference) { print "$netname $col\n"; #print the netname along with each column of the array containing the singlereference designators. } } print "done\n";