On Mon Feb 23 2009 @  6:27, r...@goto10.org wrote:
> 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;

It sounds as though you are trying to treat an array like a file. That is,
you want to go through it "line by line", and you're trying to create a new
array (@linearray) by joining the flattened results of the permute subroutine
with newlines. But the join function takes a list and produces a string
(one thing). You seem to be using it backwards - or I'm very confused by
your code. 

I don't know what's in the permute subroutine, but the problem definitely
looks to be in this line:

  my @linearray = join...etc.

Take a look at perldoc -f join and maybe try to explain what you're trying
to do in that line.

Hope this helps.

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to