in reply to Sorting data problem

Well, I don't know what you mean by "won't work" since you don't give us any sample input or output. But I did notice one problem in your code. You say you want to sort it alphabetically. Therefore instead of
@sortdata = sort { $a <=> $b } (@data);
you should have
@sortdata = sort { $a cmp $b } (@data);
or even simply
@sortdata = sort @data;
The reason is that <=> compares two values numerically whereas cmp compares them alphabetically. This is the default behavior for sort, though.