For Programmers: Free Programming Magazines  


Home > Archive > PERL CGI Beginners > October 2005 > how to write this properly?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author how to write this properly?
michal.ostruszka@gmail.com

2005-10-10, 3:55 am

Hi,

I'm brand new in Perl, and I'd like to find out a few things about
Perl, but I haven't found answers yet.
So, I've script called let's say index.pl. It contains series of
conditions and under certain conditions it does "do('display.pl')".
And display.pl contains something like that:

display.pl:
-----------
print "<table border=0><tr><td>$category</td></tr>";
print ... # next few lines of html printing

And my first question is: Either this file should have standard perl
lines like #!/usr/bin/perl, use strict, etc, or can be used like it is
written. Next question, what about $category variable?Is it visible in
display.pl if I put "use strict" and "use vars qw($category)" in
index.pl?

Next thing

If i write library with some functions, and I use it in my script using
"require", should it also have #!/usr/bin/perl, use strict, use vars
etc, lines? And the same question about configuration files, for
example:

config.pl:
-----------
#!/usr/bin/perl
#is the line above necessary in such file???

$db="dbname";
$host="hostname";
$user="username";
$pass="password";


Thanks for all replies, I hope you'll help me to understand proper
style of writing perl scripts.

Greetings.

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com