Advertisement
oylenshpeegul

Subroutine signatures in Perl

Feb 2nd, 2014
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 0.46 KB | None | 0 0
  1. #!/usr/bin/env perl
  2.  
  3. use v5.19.9;
  4. use warnings;
  5.  
  6. use feature 'signatures';
  7. no warnings 'experimental::signatures';
  8.  
  9. sub puppy_bowl ($starter, $substitute='Doodle Bug', %others) {
  10.     say "starter = $starter";
  11.     say "substitute = $substitute";
  12.     say "$_ => $others{$_}" for keys %others;
  13. }
  14.  
  15. puppy_bowl('Abdiel');
  16. say '';
  17. puppy_bowl('Abdiel', 'Alvin');
  18. say '';
  19. puppy_bowl('Abdiel', 'Alvin', backup => 'Alanis', kitty => 'Alexa');
  20. say '';
  21. puppy_bowl();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement