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 | |
|
Re: Re: Re: Function calls and list creation
by brewer (Sexton) on May 31, 2003 at 01:00 UTC |