in reply to electronic diagram recognisation

If you only have one diagram per file and the only things that matter are the "connector id" and the side it is on, this should be very easy. Left hand side connectors are all matched by /^\s*\[([^]]+)\]/ and those on the right are matched by /\[([^]]+)\]\s*$/. Just check each line for both.

Untested:

while (<>) { /^\s*\[([^]]+)\]/ and push @left, $1; /\[([^]]+)\]\s*$/ and push @right, $1; } print "Left : $_\n" for @left; print "Right : $_\n" for @right;

If you need to actually trace the lines, the problem is more difficult.

-sauoq
"My two cents aren't worth a dime.";