in reply to Re^3: Alternative values from array and print
in thread Alternative values from array and print

use strict; use warnings; use List::Util qw(first); my %data = ( date => ['2009-01-01', '2009-01-02', ''], correct => ['Article_text1', 'Article_text2'], ); print @{$data{correct}}; print @{$data{date}};
This prints out the result.
Article_text1 Article_text2 2009-01-01 2009-01-02
But the output should be something like below. The values should be printed in alternative way.
2009-01-01 Article_text2 2009-01-02

Replies are listed 'Best First'.
Re^5: Alternative values from array and print
by moritz (Cardinal) on Jul 16, 2009 at 10:57 UTC

    I don't see the pattern - why do you want only one Article_text to be printed, but two dates?

    Or was that an error on you side, and you want all of them, interleaved? If yes, you can either use List::MoreUtils::natatime, or you can simply iterate over the indexes and extract the items by index, in parallel.

    Attention to details is important for a programmer - if you give us wrong example output, we can't give you right answers. If the rules to obtain the sample output are not obvious, you have to explain them verbally.

    Seriously, try things out yourself. Read the documentation. Read other code that works with data structures, the monastery is full of it.

    Read other questions, and ask yourself if you actually understood what the other monks wanted. Ask yourself if you would understand your own questions if you were somebody else, and didn't know it already.