Current location: Hot Scripts Forums » Programming Languages » Perl » perl table


perl table

Reply
  #1 (permalink)  
Old 09-22-09, 06:19 AM
hemi hemi is offline
Wannabe Coder
 
Join Date: Aug 2009
Posts: 117
Thanks: 15
Thanked 0 Times in 0 Posts
perl table

#!C:/Perl/bin/perl.exe -w
print "<table border='1'>";

# START THE LOOP, $i is the most common counter name for a loop!
for($i = 1; $i < 5; $i++) {
# PRINT A NEW ROW EACH TIME THROUGH W/ INCREMENT
print "<tr><td>$i</td><td>This is row $i</td></tr>";
}
# FINISH THE TABLE
print "</table>";
-----------------------------------------------------------------------------------------------------------------
when iam compiling file, it is not coming in table format, it is cominig like above ,that means
<table><tr><td>1</td><td>
<tr><td>2</td><td>
<tr><td>3</td><td>
<tr><td>4</td><td> <tr><td>5</td></tr></table>
-----------------------------------------------

it is coming like that only but i want it in table format

plz anyone help me i am new to perl
Reply With Quote
  #2 (permalink)  
Old 09-22-09, 06:42 AM
wirehopper's Avatar
wirehopper wirehopper is offline
-
 
Join Date: Feb 2006
Posts: 2,515
Thanks: 20
Thanked 109 Times in 106 Posts
Do you want an HTML table or a tab delimited table?
Reply With Quote
  #3 (permalink)  
Old 09-22-09, 06:52 AM
hemi hemi is offline
Wannabe Coder
 
Join Date: Aug 2009
Posts: 117
Thanks: 15
Thanked 0 Times in 0 Posts
i want html table
Reply With Quote
  #4 (permalink)  
Old 09-22-09, 03:31 PM
wirehopper's Avatar
wirehopper wirehopper is offline
-
 
Join Date: Feb 2006
Posts: 2,515
Thanks: 20
Thanked 109 Times in 106 Posts
Are you viewing it on the command line or with a browser?
Reply With Quote
  #5 (permalink)  
Old 09-23-09, 12:26 AM
hemi hemi is offline
Wannabe Coder
 
Join Date: Aug 2009
Posts: 117
Thanks: 15
Thanked 0 Times in 0 Posts
command line

how to open it in browser

Last edited by hemi; 09-23-09 at 12:36 AM.
Reply With Quote
  #6 (permalink)  
Old 09-23-09, 06:33 AM
wirehopper's Avatar
wirehopper wirehopper is offline
-
 
Join Date: Feb 2006
Posts: 2,515
Thanks: 20
Thanked 109 Times in 106 Posts
http://domain.com/perlscript.pl

Make sure the script is in the area the web server can read. Often it is /var/www/html/perlscript.pl, or /home/account/public_html/perlscript.pl, or /home/account/public_html/cgi-bin/perlscript.pl.
Reply With Quote
  #7 (permalink)  
Old 09-23-09, 06:41 AM
hemi hemi is offline
Wannabe Coder
 
Join Date: Aug 2009
Posts: 117
Thanks: 15
Thanked 0 Times in 0 Posts
#!/usr/bin/perl print "\n"; print "\n"; print "Hello, world!\n"; print "any 0000th\n"; print 'hemisays, "Give me $000".'; print "\n"; print "\n";
------------------------------------------------------------------------------------------------------------------------------------------

it is printing whole script in this format

my code is
-----------------------------------------------------------------------------
#!/usr/bin/perl

print "<html>\n";
print "<head>\n";
print "Hello, world!\n";
print "any 0000th\n";

print 'hemisays, "Give me $000".';
print "</body>\n";
print "</html>\n";

--------------------------------------------------------------------
i think my script is in correct area ( http://localhost/perl/bin/hello.pl)

any suggestion plz

Last edited by hemi; 09-23-09 at 06:47 AM.
Reply With Quote
  #8 (permalink)  
Old 03-24-10, 05:32 PM
mhlelite_moose mhlelite_moose is offline
New Member
 
Join Date: Mar 2010
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Try running the script and sending the STD output to a file:
perl yourscript.pl >test.html
Then open test.html using internet explorer. You should see an html table.
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Perl subsititution on Windows kenkanya Perl 3 07-28-09 12:23 AM
MYSQL database countll Database 2 06-19-07 04:20 PM
What do you think of my database structure? Oskare100 Database 5 12-27-06 07:43 AM
Pretty simple ( i think) question any help!?!? 0o0o0 PHP 2 04-07-06 10:47 AM
auto table resize derick_2k JavaScript 4 04-26-04 02:32 PM


All times are GMT -5. The time now is 04:52 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.