nix
Senior Member
i have inserted a program below.
as seen below, some statements use semicolons and some use commas, there seems to be no definite rule to follow, can anyone enlighten me on this? thanks...
as seen below, some statements use semicolons and some use commas, there seems to be no definite rule to follow, can anyone enlighten me on this? thanks...
Code:
1 #!/usr/bin/perl
2 use strict;
3 use CGI':standard';
4 if(param)
5 {
6 my $entry=param('entry');
7 print header(),
8 start_html("Program 7b"),
9 #ignorecomment1
10 #ignorecomment2
11 h3("result is "),
12 `$entry`,
13 end_html();
14 }
15 else
16 {
17 print header(),
18 start_html("Program 7b"),
19 start_form(),
20 print ("Enter a valid unix command");
21 hr(),
22 textfield(-name=>'entry'),
23 submit(-value=>'submit now'),
24 end_form(),
25 end_html();
26 }
Code:
1 #! /usr/bin/perl
2 use strict;
3 use CGI':standard';
4 if(param)
5 {
6 my $cmd=param('command');
7 if(`$cmd`)
8 {
9 print header(),
10 start_html();
11 print("Result is");
12 `$cmd`;
13 end_html();
14 }
15 else
16 {
17 print("nothing entered");
18 }
19 }
20 else
21 {
22 print header(),
23 start_html(),
24 start_form(),
25 h4("enter valid UNIX command"),
26 hr(),textfield(-name=>'command'),
27 submit(-value=>'submit'),
28 end_form(),
29 end_html();
30 }
31