Re: SPOILER - Perl Easy quiz 2005-2

Chris Charley <charley-UXds4KHJg9RWk0Htik3J/[email protected]> Sun, 13 Feb 2005 03:40:38 +0000 (UTC)
Newsgroups gmane.comp.lang.perl.qotw.discuss
Message-ID <[email protected]>
Guess I was a little bit quick on the trigger - thought I had it completely 
sorted out. The cols2rows() subroutine should be more accurately defined 
(below).

Chris


sub cols2rows {
	my @cols = @_;
	my @rows;
	while(grep @$_, @cols) {
		my @tmp = ();
		for (@cols) {
			push @tmp, shift @$_ if @$_;
		}
		push @rows, [ @tmp ];
	}
	return @rows;
}