LED matrix, How to use fewer pins?

An 8x8 LED matrix has 8 anode lines and 8 cathode lines. I'll call the cathode lines columns and the anode lines rows. One way of driving it is to pull one of the column lines low, and pull the row lines corresponding to the LEDs you want lit in the column high. After a while, switch to the next cathode line and repeat. Do this fast enough and the eye can't see any flickering.

You need to use transistors or other drivers on the column lines, because you will be lighting up to 8 LEDs in a column at a time. You can drive the rows from Arduino pins, each one through a series resistor, if 20mA is enough for the LEDs.

So in its simplest form, you need 16 pins (8 for the columns and 8 for the rows). To reduce this, first use a demultiplexer on the column lines. A 3-to-8 demultiplexer such as the 74HC238 lets you select which of the 8 column lines you drive using just 3 pins instead of 8. So that's 11 pins now.

To reduce the pin count further, use an 8-bit shift register to drive the row lines. You need 3 pins to drive the shift register. So that's 6 pins in total.

To drive multiple 8x8 displays, you can connect the column lines in parallel. You can also daisy-chain the shift registers. So, with 6 pins, you can drive any (reasonable) number of 8x8 displays.