Bash readarray

Today I learned a cool way to read lines from the standard input into the indexed array. On bash using readarray I was able to read input into a variable array.

readarray myarray < list.txt 
 
for i in "${myarray[@]}"
do
echo "$i"
# or do whatever with individual element of the array
done