# YAML hash of array (ruby \<-\> perl)

**URL:** <https://www.ruby-forum.com/t/yaml-hash-of-array-ruby-perl/49751>\
**Category:** Ruby\
**Created:** [December 8, 2005, 12:19pm UTC](https://www.ruby-forum.com/t/yaml-hash-of-array-ruby-perl/49751 "2005-12-08T12:19:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![zhimin.wen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/c2a13f/32.png) [@zhimin.wen](https://www.ruby-forum.com/u/zhimin.wen)\
**Post date:** [December 8, 2005, 12:19pm UTC](https://www.ruby-forum.com/t/yaml-hash-of-array-ruby-perl/49751/1 "2005-12-08T12:19:00Z")

</div>

Hi, I am using yaml to pass data between ruby and perl.

Given the data of h={“a”=\>[1,2]}, perl’s YAML gives the result of  
a:

- 1
- 2

while ruby gives the result of, by YAML.dump(h)  
a:

- 1
- 2

Note there is no space after “a:”, while perl’s have space

Therefore, the data provided by ruby could not be used by perl.  
Is this considerd valid YAML?

Thanks!

---

<div class="post-metadata">

**Author:** ![zhimin.wen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/c2a13f/32.png) [@zhimin.wen](https://www.ruby-forum.com/u/zhimin.wen)\
**Post date:** [December 8, 2005, 12:31pm UTC](https://www.ruby-forum.com/t/yaml-hash-of-array-ruby-perl/49751/2 "2005-12-08T12:31:11Z")

</div>

> Note there is no space after “a:”, while perl’s have space

I get a space after “a:”

irb(main):020:0\> YAML.dump(h)  
=\> “— \na: \n - 1\n - 2”

---

<div class="post-metadata">

**Author:** ![zhimin.wen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/c2a13f/32.png) [@zhimin.wen](https://www.ruby-forum.com/u/zhimin.wen)\
**Post date:** [December 8, 2005, 12:44pm UTC](https://www.ruby-forum.com/t/yaml-hash-of-array-ruby-perl/49751/3 "2005-12-08T12:44:05Z")

</div>

My version of ruby is  
ruby 1.8.3 (2005-09-21) [i386-mswin32]  
Compiled myself

Yours?
