473,399 Members | 4,192 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

print .csv table in browser in perl -cgi

1
this code print file in browser but in in tabular form like in .csv file.....kindly help me out....

Expand|Select|Wrap|Line Numbers
  1. #!/usr/bin/perl -w
  2. # use lib
  3. use strict;
  4. use CGI;
  5.  
  6. # limit 1000K bytes post, permit upload
  7. $CGI::POST_MAX        = 1024 * 1000;
  8. $CGI::DISABLE_UPLOADS = 0;
  9.  
  10. my $cgi   = new CGI;
  11. my $title = "Perl Upload";
  12.  
  13. up {
  14.  
  15.         if (!$cgi->param()) {
  16.  
  17.       print $cgi->header();
  18.        print "<html><title>hh</title>";
  19.  
  20.   print "<body><form method='post'enctype='multipart/form-data'>
  21.         <input type='file' name ='filename' size='30'>
  22.         <input type='submit' name'.submit value='upload'>
  23.         <input type ='reset' name =.reset' value ='clear'></form>
  24.         </body></html>";
  25.  
  26.  
  27.  
  28. } else {
  29.  
  30.  
  31.   my $file = $cgi->param("filename");
  32.   my @filedata = <$file>;
  33.  
  34.     foreach (@filedata) {
  35.     s/</&lt;/g;
  36.     s/>/&gt;/g;
  37.  
  38.  
  39.  
  40.    }
  41.  
  42.  
  43.          print $cgi->header();
  44.          print"<html><title></title>";
  45.          print "<body>";
  46.         foreach (@filedata) {
  47.  
  48.                 print "<table border='1'><tr><td>$_<br></td></tr></table>";
  49.         }
  50.         print "</body></html> \n\n";
  51.  
  52.      wrt{
  53.         open (FH,">>$file");
  54.         print FH @filedata;
  55.         print "....................uploaded";
  56.         }
  57. }
  58. up();
  59. }
Apr 21 '08 #1
2 2542
numberwhun
3,509 Expert Mod 2GB
First, can we see a sample line of the data so we can better know what we are dealing with? Second, what are you planning on using for the keys of the hash?

Unfortunately, I don't see a question other than "can you help me out?". What is the problem you are having with your code? What are you seeing / not seeing? What are you expecting your code to do? Can you provide sample data for us to work with?

Regards,

Jeff
Apr 24 '08 #2
eWish
971 Expert 512MB
Please do not double post your questions. I have deleted your other thread regarding the same issue and same code.

--Kevin
Apr 25 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Sure | last post by:
I my php script I call a perl script that perl script will create a log file From the php script I want to read the log file and write the output to the browser. This operation has to carried out...
2
by: Yaron Cohen | last post by:
Hi, I would like to ask for your help. I am using IE5.5. I have a wide page with horizontal scroll bar. The problem is that I get only 1 page when printing it using "file->print" or...
4
by: rom | last post by:
I need to print a html table when the user clicks on a key. the problem is that i don't want the printer dialog box to appear. i guess this is impossible in javascript so i think to create an...
1
by: yichun.wei | last post by:
Perl has the ability to do the following: print <<EOF; ...reams of text goes here... EOF Is there a Python equivalent of the above Perl code? This thread has previous discussion on the...
6
by: CSharpguy | last post by:
In my gridview I have 2 -3 template fields which are hyperlinks. I allow the user to print this grid. When the grid prints it also prints the links, how can I take the user to a print preview page...
9
by: xprotocol | last post by:
Trying to print a web page that scrolls to right a bit. I would think IE would page break by default when it gets to the end of the sheet, but it doesn't, it just cuts off the print. This only...
5
Markus
by: Markus | last post by:
I'll leave out the annoying 'i'm a newbie' speech and get to the point: i'm a newbie at perl ;) First thing i ever wrote in perl and it doesnt work. I'm using xampp as my localhost - with perl...
12
by: jt2 | last post by:
Hello Perl Gurus! I'm quite a perl neophyte so I'm looking for help understanding why print doesn't print correctly. This may be a totally stupid error.... He is my program. What it is doing...
3
by: Max58kl | last post by:
Trying to access data and print it to the screen using Perl Builders I/O Window -------------------------------------------------------------------------------- Hi I am using a program called...
3
by: itdaddy | last post by:
hey perl gurus! i am new to this forum cause i need help. I have done many scripts. but i want to use perl to do this: What I want to do is this. I have a QRP file that I can convert to a txt...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.