in reply to Need Help! Two Dimentional Array Sorting
(add shebang to taste) use strict; use warnings; open(FILE,"file.txt"); my @Records = <FILE>; @Records = sort {$a cmp $b} @Records; for my $record(@Records) { print "$record \n"; }
Between them, strict and warnings would have sorted out most of your problems, including missing semi-colons.
Tho it "works," the above code is NOT a good piece of work; read perldoc -f open and perldoc -f sort with special attention to testing your open (to make sure it works/find out why it didn't work).You may find help in threads such as #146936 using the Montastery's "Search" function (top of the page).
Update: Added output statement; rephrased second para after the code for clarity.
|
|---|