CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Beginner:
sorting and putting data in table



Feb 9, 2001, 2:40 PM

Post #1 of 1 (500 views)
sorting and putting data in table Can't Post


I need to some help to do the followings:

I had created a form to collect data and save in a file separate by |

open (INFO, "$file_name");
@data = <INFO>;
foreach $data (@data) {
($1, $2, $3, $4, $5, $6, $7) = split(/\|/ , $data);

I want to open this file, pull out data and put them in the table as:

if $2 eq 'C' && $6 eq 'G' then put $2 and $6 in the first table cell

if $2 eq 'A' && $6 eq 'D' then put $2 and $6 in the second table cell

if $7 eq 'E' then put it in the third table cell.

I used: if ($2 eq 'C' && $6 eq 'G') {
print "$2 and $6\n";

But it does not display info if one of the 7 field is empty | | I have to have ALL 7 fields in order to work.

Why is this? and how can I fix it.

Any help is appreciated. I am tring to learn perl by writing cgi scripts....



Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives