develooper Front page | perl.beginners | Postings from February 2009

flattening @AoA

Thread Next
From:
rob
Date:
February 23, 2009 09:27
Subject:
flattening @AoA
Message ID:
20090223172731.GA6450@goto10.org
problem with below

@linearray prints - but just prints an array of array references (i think thats 
what it is anyway!) i tried to flatten it to @array but i dont really know what 
i am doing.
i need to have all the data in @linearray arranged so i can do pattern matching 
on a line by line basis. each line being one of the permutations of 
@phrasegroup.

any clues?

many thanks 

rob

my @phraseA = ("%1\$s'16-> ", "%2\$s16-> ", "%3\$s16-> ");
my @phraseB = ("%4\$s'''16-. ", "%5\$s16-. ", "%6\$s16-. " );
my @phraseC = ("%7\$s''16-- ", "%8\$s16-- ",  "%9\$s16-- ");
my @phraseD = ("%10\$s''16-+ ", "%11\$s16-+ ",  "%12\$s16-+ ");
my @phraseE = ("%13\$s'''16-_ ", "%14\$s16-_ ", "%15\$s16-_ ", "r16");

my @phrasegroup = ([ @phraseA ], [ @phraseB ], [ @phraseC ], [ @phraseD ], [ 
@phraseE  ] );


my @linearray =  join("\n\n", map { join " ", @$_ } permute(@phrasegroup)),"\n";

my @array = map { @$_ } @linearray;

print @linearray;

print @array;




--------------
rob@goto10.org
rob.goto10.org
--------------

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About