Viktor Rosenfeld wrote: > > Bolan Meek wrote: > > > > this one is for all the regexp, shell, and editing-experts... > > > > How about us perl hackers, hunh?! Got sumpin' g'inst us, buddy!? > > Of course not! How could I?! :)
Well, we members of the Perl Hackers Anti-Defamation League sometimes are a little touchy... > > > Well, you could use regexp in sed, or use an awk script, but if > > I had only 3x3 matrices to transform, in text, I'd > > perl -e 'for ($i=0;$i<3;++$i){<>;@entry = split ',';print > > "$i[0],$i[1],$i[2]\n";}' > > with a file directed into it, and stdout redirected to a file. > > This ..., well ..., it doesn't work. (Head under the arm) Guess I ought have _tested_ that first, hunh? > At first I thought that you meant @entry[x] in your last line, Actually, I meant $entry[x]... > but that doesn't help either. Yes, I see that now. > I always get 3 pairs of commas without the values. > Besides, the way I read the code, > it doesn't do anything usefull, because a line with values seperated by > commas, will become exactly the same line. But then again, I don't know > anything about Perl, so this is just guessing. No, you're right. That was a >quick & stupid< of me. > > > Matrixes with unpredetermined columns or rows become slightly > > trickier, but only by 1) keeping track of the length/breadth, and > > 2) nesting another loop. > > What about matrixes with a different number of columns and rows (e.g. > 4x3 or 123x234)? OK. I'll figure out why I'm not getting from my split what I expect, correct my script, extend it for arbitrary matrices, and get back to you. (Boy, do I feel foolish...) That's what I get for not actually _testing_ my code. I guess I'd better resign from the PHADL, since I'm going to give us a bad name....