in reply to Re: Function calls and list creation
in thread Function calls and list creation

It's not the parenthesis that create the list. They just group things. It's the comma. See:

#!/usr/bin/perl -w use Data::Dumper; my $sort_func = sub { $b <=> $a }; my @to_be_sorted = (1,2,3); # sort LIST my @new = sort ($sort_func, @to_be_sorted); print Dumper \@new; # sort LIST @new = sort $sort_func, @to_be_sorted; print Dumper \@new; # sort SUB LIST @new = sort ($sort_func @to_be_sorted); print Dumper \@new;

Replies are listed 'Best First'.
Re: Re: Re: Function calls and list creation
by tcf22 (Priest) on May 31, 2003 at 00:37 UTC
    That is good to know.
    Thanks.
Re: Re: Re: Function calls and list creation
by brewer (Sexton) on May 31, 2003 at 01:00 UTC

    Thanks! The penny drops a little further. I definately need to think on that, probably while sleeping....

    Regards,
    brewer