I also get Can't open perl script "readwrite.pl": No such file or directory. Probably because I do not have such a file. Either the perl script is not in the current directory or you mis-spelt the name.
By the way, your script has an errant ) on the line after the for (although I doubt that is related to your problem).