Perl is warning you that your variables have not been declared. You need to
declare the @array and $temp as my @array, my $temp.
Also, the second element of @array is $array[1] not @array[1].

Mimi

 On 23/06/2008, luke devon <[EMAIL PROTECTED]> wrote:
>
> Hi ,
>
> I tried to capture some data in STDIN and wanted compare with a Queried
> data form a database. When i run the script , there is some errors.
>
> Scalar value @array[2] better written as $array[2] at hell.pl line 22.
> Scalar value @array[1] better written as $array[1] at hell.pl line 31.
> Scalar value @array[1] better written as $array[1] at hell.pl line 32.
> Scalar value @array[1] better written as $array[1] at hell.pl line 33.
> Scalar value @array[1] better written as $array[1] at hell.pl line 38.
> Possible unintended interpolation of @array in string at hell.pl line 38.
> Global symbol "@array" requires explicit package name at hell.pl line 9.
> Global symbol "@array" requires explicit package name at hell.pl line 18.
> Global symbol "@array" requires explicit package name at hell.pl line 22.
> Global symbol "$temp" requires explicit package name at hell.pl line 30.
> Global symbol "@array" requires explicit package name at hell.pl line 31.
> Global symbol "$temp" requires explicit package name at hell.pl line 32.
> Global symbol "@array" requires explicit package name at hell.pl line 32.
> Global symbol "@array" requires explicit package name at hell.pl line 33.
> Global symbol "$temp" requires explicit package name at hell.pl line 34.
> Global symbol "$temp" requires explicit package name at hell.pl line 36.
> Global symbol "@array" requires explicit package name at hell.pl line 38.
> Global symbol "$temp" requires explicit package name at hell.pl line 38.
>
>
>
> =========================================================================================
> #!/usr/bin/perl
> use DBI;
> use strict;
> use warnings;
>
> $|=1;
>
> my ($dbh,$sth,$dbargs,$Value);
> @array;
>
>    $dbargs = {AutoCommit => 0, PrintError => 1};
>
>    $dbh = DBI->connect("dbi:SQLite:dbname=Radius","","",$dbargs);
>
>    if ($dbh->err()) { die "$DBI::errstr\n"; }
>
>                while (<STDIN>){
>                        @array = split(/ /);
>
>              #DB searching using the IP
>
>            $sth = $dbh->prepare("SELECT x-1 from Table1 where x-2 = '" .
> @array[2] . "'") || die "Dead";
>            $sth->execute() || die "Unable to execute query:
> $DBI::errstr\n";
>
>            while (my $ref = $sth->fetchrow_hashref()) {
>
>            $Value = $ref->{'x-1'};
>
>            #END
>                    $temp = "";
>                      if (!(@array[1] =~ m#value#)) {
>                            $temp = "302:" .  @array[1];
>                                if (@array[1] =~ m/\?/) {
>                                  $temp .= "&value='" . $Value . "'";
>                                }else {
>                              $temp .= "?value='" . $Value . "'";
>                            }
>                        [EMAIL PROTECTED];
>                        print;
>                      }else {
>                        print;
>                      }
>                }
>
>            $dbh->commit();
>            $dbh->disconnect();
>    }
>
> Could you please help me to solve this problem , what are those scalar
> errors in the code ? please help me
>
> Thank you
> Luke
>
>
> Send instant messages to your online friends http://uk.messenger.yahoo.com

Reply via email to