On Tue, Oct 09, 2001 at 12:30:27AM +0200, Abigail wrote:
> 
> If the goal is to make it easier understood by beginners, I'd prefer
> 
>          sub fisher_yates_shuffle {
>          # Note that $array is a reference to an array.
>          my $array = shift;
> 
> over
> 
>          sub fisher_yates_shuffle {
>          my $arrayref = shift;

Seconded, 100%. Comments Are Our Friends.

However, note the implicit use of @_ in shift. Yes, this behaviour is
documented in the Camel book. But the use of implicit arguments is still
confusing to beginners at some stages (presumably not by the time they're
getting heavily into sorting algorithms). I'd be a bit happier if it was
written as:
   
   sub fisher_yates_shuffle {
       # Takes a single parameter, a reference to an array
       my $array = shift @_;




-- Charlie

Reply via email to