Matt wrote:
I believe you can sort an array like so:
sort @my_array;
That should be:
@my_array = sort @my_array;
I need to sort a string though.
I have $a_string that contains:
4565 line1
2345 line2
500 line3
etc.
Obviously \n is at end of every line in the string. I need it sorted.
How would I approach this?
$a_string = join '', sort $a_string =~ /.*\n/g;
John
--
Any intelligent fool can make things bigger and
more complex... It takes a touch of genius -
and a lot of courage to move in the opposite
direction. -- Albert Einstein
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/