I for sure understand that you don't want to process static data appended at the end of your program. That wouldn't be very useful, this was just an example for you. If you were reading from a file lines looking like the sample data at the end of my program, you could use exactly the same syntax.

Your slightly different syntax is correct to visit all the @con array elements.

But for your program as you showed it to work correctly, each of the @con array elements needs to contain a pair of words separated by a white space. For example, you could possibly have:

to work correctly, the @con array element being visited must contain two words separated by a white space (or, at least two words, but if there are more than two words, only the first two words would be taken into account).

In other words, each array element must contain something looking more or less like anyone of the lines I used in my input example (except that the words may contain more than one letter).

The alternative is that you tell me what you currently have in the @con array, so that I can change my sample syntax to fit it to your data format, if possible.

Currently, it looks like @con might just be empty. Possibily you chould try to print it contents. Or maybe I could help you if you told me how you are currently trying to populate this array.