Guest User

Untitled

a guest
Jul 18th, 2018
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. [23:44][markca@app-1001:~/projects]
  2. $ cat test.pl
  3. my $hash = {
  4. '1' => 'a',
  5. '2' => 'b',
  6. '3' => 'c',
  7. '4' => 'd',
  8. };
  9.  
  10. print "Keys: \n";
  11. foreach (keys(%{$hash})) {
  12. print $_ . "\n";
  13. }
  14.  
  15. print "Values: \n";
  16. foreach (values%{($hash)}) {
  17. print $_ . "\n";
  18. }
  19.  
  20. [23:44][markca@app-1001:~/projects]
  21. $ perl -w test.pl
  22. Keys:
  23. 4
  24. 1
  25. 3
  26. 2
  27. Values:
  28. d
  29. a
  30. c
  31. b
Add Comment
Please, Sign In to add comment