[ back to toc ]

Spliting Flat File Databases without a ,

Date: 2002/03/20 15:10

Q:
Hi there,

I need to create a flat-file database that may contain comers in the text
fields. Hence I can't split the file with comers. I have used | but
really I need to easily import and export files from Excel.

I would like to split the file with a TAB, but can't seem to get \t
working.

What's the syntax of the split command? What does /\,/ stands for? i.e.
split(/\,/, $entries);

Do you know better way of storing this type of database and having the
functionality to use it with Excel?

Many Thanks

*NAME-DELETED*

A:
There are three issues:

1. storing the data
2. exporting to excel
3. importing from excel

1. Storing the data is the easiest in some SQL database, for example in
MySQL. This needs learn a bit of SQL? but that is really not a big deal.

2. Exporting to excel: use Excell97 or later. Export your data into an
HTML table syntax using TABLE, TR, TD tags. Excel will import it. You can
even specify fonts, or references to other fields. For example

<TD>=A1*A2</TD>

will be treated by Excel as a cell with a calculation in it.

3. Importing from excel exported data. Export data tab delimited. Read the
lines and split them. The syntax of split is:

@array = split /regular expression/ , $string;

Thus /\,/ stands for a regular expression containing only a comma
character. Read a bit more if needed on regular expressions.

I hope this helps.

regards,
Peter

[ back to toc ]