fork download
  1. #!/usr/bin/perl
  2. use strict;
  3. use Hash::Util qw(lock_keys);
  4.  
  5. sub doSomething {
  6. my ($a, $b, %opts) = @_;
  7. lock_keys(%opts, qw(myOption, otherOption));
  8.  
  9. my $x = delete $opts{otherOption};
  10.  
  11. }
  12.  
  13. my %h = (
  14. a=>1,
  15. b=>2
  16. );
  17.  
  18. foreach my $k (keys %h) {
  19. doSomething(1, 2, otherOption=>$k);
  20. }
  21.  
Success #stdin #stdout 0s 4040KB
stdin
Standard input is empty
stdout
Standard output is empty