Hi,

I just want to say that the case that I am asking is solved already with some help from you. Thank you very much to all of you.

 

 

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Gert Lombard
Sent:
Monday, March 10, 2003 6:48 PM
To: 'Eko Budiharto'; [EMAIL PROTECTED] ActiveState. com; [EMAIL PROTECTED] ActiveState. com
Subject: RE: (no subject)

 

Hi,

 

There are, as is usually the case in Perl, many ways to compare strings.  But what you probably want is:

if ($username eq "administrator" && $password eq "test") { ...

 

"eq" and "ne" are used for string comparisons.  == and != are used for numbers.

 

In this case you shouldn't have the "if" in the else line.  (And "else" is not a "method" - it's a statement/keyword :-))

 

To "call" another HTML page, you have 2 options that I can think of (I'm assuming you're doing this from a CGI script):

1. redirect to the other page (this keeps your perl script cleaner, but requires an additional HTTP roundtrip)

2. read and display the contents of the static HTML file

 

  use CGI;

  my $q = new CGI;

   ...

  print $q->redirect("right.html");

 

For 2:

  # not necessarily the best way to do it...

  local $/ = undef;   # slurp mode...

  local F;

  open(F, "right.html");

  my $text = <F>;

  print $text;

 

If you're just beginning with Perl, read at least through the following sections in the ActivePerl User Guide:

perlsyn, perldata, perlfunc, perlop, perlsub

 

Optionally get "Programming Perl" and/or the "Perl Cookbook".

 

Good luck,

-Gert

-----Original Message-----
From: Eko Budiharto [mailto:[EMAIL PROTECTED]
Sent:
Sunday, March 09, 2003 1:57 PM
To: [EMAIL PROTECTED] ActiveState. com; [EMAIL PROTECTED] ActiveState. com
Subject: (no subject)

Is there any one know how to call a html file from perl?

Thank you very much.

 

# is this the right way to compare string?

if (($username = "administrator") && ($password = "test")){

#       call http://right.html

}

# is this the right way to use else method

else if {

#       call http://wrong.html

}

 

Reply via email to