sort function in perl

Hi,

 here is my perl script.This script creates an array and is sorting it using the in-built sort function in perl.
#!/usr/local/bin/perl
    my number=6;
    my @num_arr=(1,2,3,4,5);
    my @array=(23,"$number","Hello",2.345,@num_arr);

    #printing the array
    print "@array\n";

   #sorting the array
   my @sorted    = sort @array;
   print "Sorted : @sorted\n";

The output is an shown below:

23 6 Hello 2.345 1 2 3 4 5
Sorted : 1 2 2.345 23 3 4 5 6 Hello

Can anyone suggest why the sort function act differently?

With Regards
Dileep Pattayath

What is "differently"? It appears expected for me.

From the sort documentation:

It treats everything as string and sorts in ASCII order. So, back to the question, what do you expect to see here?

If in case you want the array sorted numerically, write:

my @sorted    = sort { $a <=> $b } @array;