http://www.perlmonks.org?node_id=1056479


in reply to execution of command inside for loop fails

I see "i++" instead of "$i++". I would suggest using foreach loop in such cases, no need for a loop variable.

UPDATE: Please next time also add a description of how it is not working. You'll get much better answers that way