http://qs321.pair.com?node_id=481192


in reply to Re: Splitting multiline scalars into different array entries
in thread Splitting multiline scalars into different array entries

Hmmm... that was my first result. See my desired output. Thanks anyway!

davis
Kids, you tried your hardest, and you failed miserably. The lesson is: Never try.
  • Comment on Re^2: Splitting multiline scalars into different array entries

Replies are listed 'Best First'.
Re^3: Splitting multiline scalars into different array entries
by broquaint (Abbot) on Aug 05, 2005 at 11:23 UTC
    Ah yes, it seems I missed the transposition.
    use Algorithm::Loops 'MapCar'; my @results = map { grep(/\n/,@$_) ? MapCar {[@_]} map([split "\n"], @$_) : $_ } @AoA;
    And to be sure:
    HTH

    _________
    broquaint

      broquaint: Thank you very much. I had just seen frodo's link, and was struggling with MapCar myself. That's exactly what I was after.

      davis
      Kids, you tried your hardest, and you failed miserably. The lesson is: Never try.
      i wanna split a file which has 3 char and all 21 values in a single line ie each char has 7 values.so i need to split it as 7 in each line by input file.