>123420010110010010101 (and so on this way => ) >234531111101100101010 >678940000010010111010 >340151010101110101010 >and so on... > >Now let's say the first four characters are a PIN number, >the following two characters the subject's age, and so on. >How can I read such a file split in (fixed) columns ? >I would like to insert tabs at the end of each field, creating >a tab-delimited text file. > This is my solution: I assume you are reading the text file through a filehandle: <F> while (<F>) { $_ =~ s/(\d{4})(\d{2})(\d{15})/$1\t$2\t$3/; $fHolder .= $_; } The regular expression groups each line into three sets of 4, 2 and 15 digits respectively and then reconstructs the line with the tab character between grouped sets. Each line thus processed is appended to the variable $fHolder for further processing (or for writing out to disk). Hope this helps. Happy New Year to all on the list. Gauden Galea http://www.synapse.net.mt