Hai provato a scrivere:
print "@words[$nword]\n";