Questions tagged [hashrocket]

The `=>` symbol for building hash literals in Perl and Ruby.

The hash rocket is the => symbol that is used to build hash literals in Perl:

my %h = ( a => 'b' )

and Ruby:

h = { :a => 'b' }

The hash rocket is also known as a fat comma in the Perl world as it behaves similarly to a comma that stringifies its left side.

16 questions
-2
votes
2 answers

Why does Ruby use the '=>' notation?

Where did it come from? Why didn't they use -> or some other notation?
B Seven
  • 44,484
  • 66
  • 240
  • 385
1
2