http://www.perlmonks.org?node_id=714845


in reply to results from pairs combination

Update: original posting changed massively in the mean time, so this is kinda out of context. In case of doubt just ignore it.

Do you always want to change the order of the last two elements? If yes

@pairs[-1, -2] = @pairs[-2, -1];

should work for you.

Replies are listed 'Best First'.
Re^2: results from pairs combination
by lipong (Initiate) on Oct 01, 2008 at 17:16 UTC
    Thanks for the quick reply The idea is not the order but each pair represents the relations between the elements so for example: @pairs=("a,b","c,b","d,f","e,b","f,g"); The results should be: "a,b","c,b","e,b" "d,f","f,g"; But the pairs can appear in any order and combination.