On Tue, 06 Oct 2009 11:57:53 +1000, Jyoti <jcutiep...@gmail.com> wrote:

Hello All,

Can anyone please help with one small error I am getting for line 16( The
one which is bold n italic below.)
The error is : Can't call method "str" on an undefined value at firstpage.pl
line 16.

Just a warning, I am also a beginner Perl programmer. But your validate subroutine looks like JavaScript* code. But I could be wrong.

Nevertheless, hope that helps.

Dave

*http://en.wikipedia.org/wiki/JavaScript



#!/usr/bin/perl
# standard settings plus call for CGI package
#use strict;
#use warnings;
use CGI;
use Bio::Seq;
use Bio::SeqIO;
use Bio::AlignIO;

#subroutine

&validate;

sub validate()
{
   * $q->str=document.form1.login.value; *
    if(str.length > 6)
    {
        $q->number=str.indexOf("@");
        if(number!=-1)
        {
            $q->number=str.indexOf(".");
            if(number==-1)
            {
                $q->document.form1.login.focus();
                alert("Please Enter a valid email id");
                return false;
            }
        }
        else
        {
            $q->document.form1.login.focus();
            alert("Please Enter a valid email id");
            return false;
        }

    }
    else
    {
    $q->document.form1.login.focus();
    alert("Please Enter a valid email id");
    return false;
    }
}


--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to