Generating Simple Report

Domain Hosting image
Web Hosting
Dedicated server
ssl certificate
Web Design image
Email

The idea of a report starts with the premise that you have lots of data, but the data is not in a readily usable form. You want to print out the data in a nice format so that you can actually use the information. Suppose that you have a database of inventory for a computer store). Each month, you may want to print out a list of items on sale. A typical list might be formatted as follows :

Order #DescriptionSale Price
9702101 166 MHz Pentium, 16 MB/2. 1GB 1795.50
9702103 166 MHz Pentium MMX, 32 MB/3.2GB 1GB 2375.95

Organizing data in text files

To print reports you need a source of data. Before showing you have to generate formatted reports, this section focuses on data storage in text files. You can store a lot of useful information in an organized format in a plain text file.

One common way to organize information is to present it in a tabular form.

You can store the sample inventory information by using this approach of separating the fields with a special character. If you were to use the vertical bar ( I ) as a separator, the text file containing the inventory information might have the following appearance :

9702101 1166 MHz Pentium, 16 MB/2. 1 GB 1 1795.50 9702103 1166 MHz Pentium MMX, 32 MB/3.2GB 12375.95

This file can serve as the inventory database, with each line containing the information about a specific item.

When you write Perl programs to work with such data files, you can use the split function to separate out the fields contained in each line if text. For example if Vine contains a line of data and the fields separator is the vertical bar, you car obtain the array of fields with the following line of code

@fields = split (/ \ I / , $ line) ;



Domain Name Search

www.


Copyright (C) 2007. Web Domain design hosting. All rights reserved.