in reply to calling sub routine problem?

I strongly suggest you stop using subroutine prototypes. The way you have used them above is completely misleading. You have several things you need to learn about Perl but mostly all you need to learn about Perl's subroutine prototypes at this point is "don't use them". (:

Now, to questions you didn't ask... Perl subroutines get passed a list of scalar "values" (I put "values" in quotes for reasons that I'll won't explain because they don't affect the problem you are having right now). So if you have

my @sorted= sort qw(this list isn't sorted yet); my $num= 3; display_results( @sorted, $num );
then the display_results subroutine gets passed the following list of values: ("isn't","list","sorted","this","yet",3) You'll note that there is no special mark between "yet" and 3. So, inside the subroutine, @_ will be set to that list. $_ will be set to whatever it was set to before as $_ isn't used for passing arguments to subroutines.

So if you want to pass both some scalars and an array/list to a subroutine, then you need to make the array/list as the last argument:

display_results( $num, @sorted ); sub display_results { my( $num, @sorted )= @_;
I suggest you do some reading in any of the many fine sources of documentation on this stuff. (:

        - tye (but my friends call me "Tye")