Forum: Ruby YAML hash of array (ruby <-> perl)

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
8f96c3f92bb41dc5c1bc345110923d46?d=identicon&s=25 zhimin.wen (Guest)
on 2005-12-08 12:19
(Received via mailing list)
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!
Ad97b577f331ae29ed90da5751f2e44f?d=identicon&s=25 dandiebolt (Guest)
on 2005-12-08 12:31
(Received via mailing list)
>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"
8f96c3f92bb41dc5c1bc345110923d46?d=identicon&s=25 zhimin.wen (Guest)
on 2005-12-08 12:44
(Received via mailing list)
My version of ruby is
           ruby 1.8.3 (2005-09-21) [i386-mswin32]
Compiled myself

Yours?
This topic is locked and can not be replied to.