# Splat behavior with different versions of ruby

**URL:** <https://rubytalk.org/t/splat-behavior-with-different-versions-of-ruby/13160>\
**Category:** ruby-talk\
**Created:** [20 August 2004 03:53 UTC](https://rubytalk.org/t/splat-behavior-with-different-versions-of-ruby/13160 "2004-08-20T03:53:16Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mehr\_Assaph\_Assaph](https://avatars.discourse-cdn.com/v4/letter/m/77aa72/32.png) [@Mehr\_Assaph\_Assaph](https://rubytalk.org/u/Mehr_Assaph_Assaph)\
**Post date:** [20 August 2004 03:53 UTC](https://rubytalk.org/t/splat-behavior-with-different-versions-of-ruby/13160/1 "2004-08-20T03:53:16Z")

</div>

> This is probably common knowledge, but the references I could find

where

> annotated only in Japanese so I'm just not sure what is happening

here:

> #########################################################  
> #!/usr/bin/env ruby  
> puts "VERSION: #{RUBY\_VERSION}"  
> puts "PLATFORM: #{RUBY\_PLATFORM}"  
> h = { 'foo'=\>3, 'bar'=\>56 }  
> h.each do |\*items|  
> &nbsp;&nbsp;&nbsp;puts "items is of type #{items.class}"  
> &nbsp;&nbsp;&nbsp;puts "1 = #{items[0]}, 2 = #{items[1]}"  
> end  
> #########################################################

> So out of 1.6.8, 1.7.2, 1.8.0, and 1.8.1, only 1.8.1 exhibits the  
> behavior that I find counterintuitive. Is this the way it is supposed

> to work? If so, what is the rationale?

1.8.2 behaves the same as 1.8.1.  
Works as expected without the splat:

c:\\>ruby  
puts "VERSION: #{RUBY\_VERSION}"  
puts "PLATFORM: #{RUBY\_PLATFORM}"  
h = { 'foo'=\>3, 'bar'=\>56 }  
h.each do |items|  
&nbsp;&nbsp;&nbsp;puts "items is of type #{items.class}"  
&nbsp;&nbsp;&nbsp;puts "1 = #{items[0]}, 2 = #{items[1]}"  
end  
^Z

VERSION: 1.8.2  
PLATFORM: i386-mswin32  
items is of type Array  
1 = foo, 2 = 3  
items is of type Array  
1 = bar, 2 = 56
