in reply to Last position of array

Below is a code which could print the last word or the word you wanted to be printed.

open(FH, "input.txt"); while(<FH>){ push (@after_split, split(/\n/)); } push (@final_output, split(/,/,$after_split[scalar @after_split - 1])) +; print "Words you wanted\t".$final_output[0]."\n";