in reply to Printing an array

You have defined the subroutine readata, but you haven't called it before your print statement. Hence the array DATA is undefined.

You probably need to add

my @DATA = readdata();
before the print statement.

--t. alex
Life is short: get busy!