This is being a little picky, but I noted you used:
sub find_pairing($white_player){ ... }
in the code snippet. This prototype will work, but isn't strictly correct. It would be better to say:
sub find_pairing($) { ... }
I also noted that some of the replies used:
sub find_pairing() { my $white_player = shift; ... }
This is bad. If you call this method after this declaration, then a call like find_pairing("Bob") will fail because the prototype will accept no arguments. It would be better to say nothing about the signature of the subroutine like:
sub find_pairing { ... }
Anyway, you're all probably aware of this, but I wanted to make sure the casual browser, who might not, knows the difference between these slight variations. I look forward to Perl 6, where this cruft will be cleaned up.
In reply to Re: Question regarding variable scope
by hanenkamp
in thread Question regarding variable scope
by jpfarmer
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |