#!/usr/local/bin/perl use Data::Dumper; map{(/\n/)?$i=0*$j++:$r[$i++][$j]=$_;}split // while(); print Dumper(\@r); __DATA__ ABC DBC ECC