fork download
  1. # Create Hashes for Tweets, in Ruby, for Final Question 11
  2. # Tim Conklin
  3.  
  4. perl = {
  5. "perl1" => "Perl is Object Oriented as well as Functional.",
  6. "perl2" => "After learning Perl you practically know Python and Ruby.",
  7. "perl3" => "Perl + CPAN = not reinventing the wheel.",
  8. "perl4" => "Perl is the Swiss army knife of the Internet. That's pretty darn cool!",
  9. "perl5" => "Smaller file sizes with large results.",
  10. "perl6" => "Perl is Free. If it's free, it's for me!",
  11. }
  12.  
  13. printf "A few tweets from perl Marx: \n\n"
  14. perl.each { |key, val| puts "(#{key}) #{val}" }
  15.  
  16. printf "\n\nThese are the keys: \n\n"
  17. perl.each_key { |key| print key, " \n" }
  18.  
  19. printf "\n\nThese are the values: \n\n"
  20. perl.each_value { |key| print key, "\n" }
  21.  
  22.  
Success #stdin #stdout 0s 28216KB
stdin
Standard input is empty
stdout
A few tweets from perl Marx: 

(perl1) Perl is Object Oriented as well as Functional.
(perl2) After learning Perl you practically know Python and Ruby.
(perl3) Perl + CPAN = not reinventing the wheel.
(perl4) Perl is the Swiss army knife of the Internet. That's pretty darn cool!
(perl5) Smaller file sizes with large results.
(perl6) Perl is Free. If it's free, it's for me!


These are the keys: 

perl1 
perl2 
perl3 
perl4 
perl5 
perl6 


These are the values: 

Perl is Object Oriented as well as Functional.
After learning Perl you practically know Python and Ruby.
Perl + CPAN = not reinventing the wheel.
Perl is the Swiss army knife of the Internet. That's pretty darn cool!
Smaller file sizes with large results.
Perl is Free. If it's free, it's for me!