On Jun 23, 8:36 am, [EMAIL PROTECTED] (Luke Devon) wrote: > 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. ... > 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 "$temp" requires explicit package name at hell.pl line 30. ... > #!/usr/bin/perl > use DBI; > use strict; > use warnings; > > $|=1; > > my ($dbh,$sth,$dbargs,$Value); > @array;
my @array; # Global symbol "@array" requires explicit package name at hell.pl line 9. But see below ... > > $dbargs = {AutoCommit => 0, PrintError => 1}; > > $dbh = DBI->connect("dbi:SQLite:dbname=Radius","","",$dbargs); > > if ($dbh->err()) { die "$DBI::errstr\n"; } > > while (<STDIN>){ > @array = split(/ /); my @array = split(/ /); Since you only use @array in this block, only declare it in this block. But since you only use [1] and [2], what about: my( $msg, $ip ) = (split / /)[1,2]; BTW: There's a difference between 'split(/ /)' and 'split(" ")' in case it matters. > > #DB searching using the IP > > $sth = $dbh->prepare("SELECT x-1 from Table1 where x-2 = '" . > @array[2] . "'") || die "Dead"; # Scalar value @array[2] better written as $array[2] at hell.pl line 22. $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 = ""; my $temp = ""; # Global symbol "$temp" requires explicit package name at hell.pl line 30. > if (!(@array[1] =~ m#value#)) { # Scalar value @array[1] better written as $array[1] at hell.pl line 31. if (!($array[1] =~ m#value#)) { > $temp = "302:" . @array[1]; > if (@array[1] =~ m/\?/) { > $temp .= "&value='" . $Value . "'"; > }else { > $temp .= "?value='" . $Value . "'"; > } > [EMAIL PROTECTED]; # Possible unintended interpolation of @array in string at hell.pl line 38. s#$array[1]#$temp#; > 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 -- Brad -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/