Here is how I create my bash array:

while read line
do
   myarr[$index]=$line
   index=$(($index+1))
done < lines.txt

The file "lines.txt" constists of the following strings

hello big world!
how are you
where am I

After creation of ${myarr[@]} I can easily access every element (line) in this array issuing

echo ${myarr[2]}

But what if I want to extract just world!? Is it possible to extract world! from 0 element of the myarr? What's most important, is it possible to extract any last word from the myarr element?

I know that in python you can do myarr[0][3] and that will do the trick, how about bash?

Edit
Report