Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

perl file output could not start from left top?

Posted on 2000-03-13
6
202 Views
Last Modified: 2010-03-05
I use the following perl file , use table , try to output datafile, how come the
output html fail to start from left-top corner? how to format it start from the left-top beginning?


#!/usr/local/bin/perl  

require "cgi-lib.pl";

# Use the
use Getopt::Long;
use English;
use AnyDBM_File;


print "Content-type: text/html\n\n";
print"<html>\n";
print"<head>\n";

print"<title>please fill out</title>";
print"</head>";

print"<body>";

# Set up the command line options.
my $ret            = GetOptions ("d|database:s");

my $database   = "convert.dbm";
my (%contents,$count,$type,$name,$price,$desc,$record);

# Open the DBM database file.
dbmopen (%contents, $database, 0700) || die "Could not open DBM file $database : $!\n";

# Force the top of page.
$FORMAT_LINES_LEFT = 0;
$count = 0;



print"<table>";

      print "<tr>";
        print"<td>Count Item # </td>";
        print"<td>Item Type </td>";
        print"<td>Item Name </td>";
        print"<td>Price </td>";
        print"<td>Description</td>";
        print"</tr>";


# Start printing out the dbm information.
for $number (sort keys %contents)
{
   # Get the contents from the hash.
   $record = $contents{$number};

   # Split the record up.
   ($type,$name,$price,$desc) = split (/\|/, $record);
   $count++;

   # Write it...
      #write
      print "<tr>";
      print"<td> $count</td>";
      print"<td> $type</td>";
      print"<td> $name</td>";
      print"<td> $price</td>";
      print"<td> $desc</td>";

      print"</tr>";
      print"<br>\n";

}

print"</table>";
print"</body>\n";

print"</html>\n";


# Close the DBM database.
dbmclose %contents;
0
Comment
Question by:syu1
  • 3
  • 2
6 Comments
 
LVL 16

Accepted Solution

by:
maneshr earned 50 total points
ID: 2613998
add this line of HTML code before print "<table>";

                   NOTE:    

                   TOPMARGIN and LEFTMARGIN establish margins in MSIE.
                   MARGINHEIGHT and MARGINWIDTH establish margins in Netscape.

                   print "<BODY TOPMARGIN=0 LEFTMARGIN=0 MARGINHEIGHT=0
                    MARGINWIDTH=0> \n";
0
 

Author Comment

by:syu1
ID: 2614415
sorry , I try , it dont work at all!
0
 

Author Comment

by:syu1
ID: 2614517
sorry , I try , it dont work at all!
0
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
LVL 16

Expert Comment

by:maneshr
ID: 2614545
are you using frames???

0
 
LVL 16

Expert Comment

by:maneshr
ID: 2617218
you have duplicate postings of this question. please delete one of them.
0
 
LVL 3

Expert Comment

by:jyu_88
ID: 2617908
run it from the command line and capture the HTML to a file. try to view the file yourself and also post the HTML here.

CGI.pm is preferred over old cgi-lib.pl.
-cut-----cut------cut-----cut---
#! /usr/bin/perl -w
use CGI;
my $query = new CGI;
print query->header(-type=>'text/html');
print $query->start_html(-title=>'please fill out');
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Perl script to parse log and delete the file 17 176
Exchange 2010 Transport Rule Regex 28 118
How to search multiple patterms in a file with perl? 4 82
Perl Frameworks 1 96
A year or so back I was asked to have a play with MongoDB; within half an hour I had downloaded (http://www.mongodb.org/downloads),  installed and started the daemon, and had a console window open. After an hour or two of playing at the command …
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

766 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question