in reply to Creating array from previous script using split

So you're splitting and sorting in the second script after outputting only a single string from the first, correct?

You're very close with your split and sort so I'll let you peruse the docs so you can learn how to finish that.

For passing data from one script to another in the manner you've been asked, you'll need to print the string at the end of script one, then research how to use the STDIN file handle as input into a script, to accept the data into script two.