Treating a list from a file as an array, it can be iterated as:
PS /home/nicholas/powershell/csv>
PS /home/nicholas/powershell/csv> $words = Get-Content ./sort.txt
PS /home/nicholas/powershell/csv>
PS /home/nicholas/powershell/csv> $words
Alpha
Hotel
Bravo
Charlie
Delta
Echo
Golf
Foxtrot
Zulu
Hotel
India
Kilo
Juliett
Lima
Mike
November
Oscar
Papa
India
Quebec
Romeo
Sierra
Tango
Charlie
Uniform
Victor
Whiskey
Alpha
X-ray
Yankee
Zulu
PS /home/nicholas/powershell/csv>
PS /home/nicholas/powershell/csv> foreach($w in $words){echo $w}
Alpha
Hotel
Bravo
Charlie
Delta
Echo
Golf
Foxtrot
Zulu
Hotel
India
Kilo
Juliett
Lima
Mike
November
Oscar
Papa
India
Quebec
Romeo
Sierra
Tango
Charlie
Uniform
Victor
Whiskey
Alpha
X-ray
Yankee
Zulu
PS /home/nicholas/powershell/csv>
but how is that array sorted?
The list perhaps a bit long, just experimenting a bit with arrays and lists of data to grasp the syntax of powershell and how to use data correctly.
This data originated on a website, I put into a spreadsheet, then CSV, and am just futzing with the data.
see also:
Sort-Objectcan be used to sort arrays, is that what you meant?