in reply to YAML newbie help

I'm looking for some documentation that can get me started real quick, with cut-and-pasteable practical examples
Everything you've references, the yaml site ... all fit the bill.
Please help me get past this kind of nonsense...
Why is that nonsense? It says you're missing '---' at some place, what exactly are you doing (where is the relevant code, sample data -- How (Not) To Ask A Question )?

MJD says "you can't just make shit up and expect the computer to know what you mean, retardo!"
I run a Win32 PPM repository for perl 5.6.x and 5.8.x -- I take requests (README).
** The third rule of perl club is a statement of fact: pod is sexy.

Replies are listed 'Best First'.
Re^2: YAML newbie help
by Tortue (Scribe) on May 31, 2005 at 10:00 UTC
    My humble apologies for wasting your time. How silly of me not to see that the answer was contained in my own question! I of course didn't mean the message was nonsense. I meant the nonsense was in my behavior. I foolishly thought there might be some list of examples like the Perl data structures cookbook, but for YAML, that my poor searching abilities hadn't uncovered. And that next time someone searched for YAML in this site, they'd be happy to find this node. I'll do penance for my presumption.

    I'm sorry I wasn't more specific. My original, very trivial problem was to have a list of days, with for each day a team of people, and a head of a team.

    By trial and error, I found this:

    days: - date: 2005-06-01 team: - Jack - Jill - Joe boss: Clara - date: 2005-06-02 team: - Harry - Hillary - Howie boss: Victoria
    It does the trick, producing an array of hashes of arrays. Now (does my greed know no bounds?) I'm wondering if there's a more concise way, so that team members could be on the same line. At the same time I feel shame to even mention it, because I'm sure the answer is in the fine documentation, and it's just my poor eyes that don't see it! But perhaps wisdom can be achieved through shame.
      Indeed, answering my own question after reading more of the long, but well-written specification: a more concise, but equivalent version, is of course:
      - date: 2005-06-01 team: [ Jack, Jill, Joe ] boss: Clara - date: 2005-06-02 team: [ Harry, Hillary, Howie ] boss: Victoria
      Even more concise, each day can be made to fit on one line:
      - { date: 2005-06-01, team: [ Harry, Hillary, Howie ], boss: Clara + } - { date: 2005-06-02, team: [ Jack, Jill, Joe ], boss: Victor +ia }
      which makes it more readable as a table.

      I wonder if you can simplify even further, by factoring out the hash keys? Something on the order of:

      # INCORRECT YAML SYNTAX - { date:, team:, boss: } - { 2005-06-01, [ Harry, Hillary, Howie ], Clara } - { 2005-06-02, [ Jack, Jill, Joe ], Victoria }
      Probably not.
        I see. I always start with `perldoc YAML', so I would've approached the problem the same way grinder would, akin to
        use YAML; my( @foo ) = ({ 'date' => '2005-06-01', 'boss' => 'Clara', 'team' => [ 'Jack', 'Jill', 'Joe' ] }, { 'date' => '2005-06-02', 'boss' => 'Victoria', 'team' => [ 'Harry', 'Hillary', 'Howie' ] } ); local $YAML::Indent = 4; local $YAML::UseFold = 1; print Dump( \@foo ); __END__ --- - boss: Clara date: 2005-06-01 team: - Jack - Jill - Joe - boss: Victoria date: 2005-06-02 team: - Harry - Hillary - Howie
        Too bad there isn't an option yet to compress sequences.

        MJD says "you can't just make shit up and expect the computer to know what you mean, retardo!"
        I run a Win32 PPM repository for perl 5.6.x and 5.8.x -- I take requests (README).
        ** The third rule of perl club is a statement of fact: pod is sexy.