in reply to Re^4: foreach loop
in thread foreach loop

Of course there is!

This is Perl.

However, to learn how to do so (we are here, after all, to help you learn, not to do it for you), I would suggest push. Using the example there, you could create an array with elements 0, 2, 4 ... containing the "@char\d" and the odd-numbered elements with the data. Alternately (and perhaps better), see the Tutorials on hashes, here in the Monastery
    ...just for starters, that is.