Problem when use split
From: John Doe (axam_at_vcable.net)
Date: 04/29/04
- Next message: Casey West: "Re: Problem when use split"
- Previous message: cAry: "real newbie help needed"
- Next in thread: Casey West: "Re: Problem when use split"
- Reply: Casey West: "Re: Problem when use split"
- Maybe reply: Bob Showalter: "RE: Problem when use split"
- Reply: John W. Krahn: "Re: Problem when use split"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
To: beginners@perl.org Date: Thu, 29 Apr 2004 14:44:56 +0300
Hello all,
i write script that open and read file but i have problem.
First, here are a script:
----
#!/usr/bin/perl
use DBI;
my $dbuser = "xxx";
my $dbpass = "xxx";
my $db = "xxx";
my $u_dbuser = "xxx";
my $u_dbpass = "xxx";
my $u_db = "xxx";
my $sth = "";
my $dbh = "";
my $result = "";
my $sql = "";
my $tree = "/mnt/ftp/ftp1/users/";
my $user = "";
my $filequota = ".ftpquota"; # file contain record format 0 0
my $temp = "";
$sql = "SELECT username FROM tbl_users";
$dbh = DBI->connect("DBI:mysql:$db", $dbuser, $dbpass) || die "MySQL is
down\n";
$sth = $dbh->prepare($sql);
$sth->execute;
$dbhnew = DBI->connect("DBI:mysql:$u_db", $u_dbuser, $u_dbpass) || die
"MySQL is down\n";
while(my @rows = $sth->fetchrow_array) {
$user = $rows[0];
$fulltree = $tree . $user . "/" . $filequota;
$files = 0;
$quotause = 0;
if (-e $fulltree) { # check to see if file exist
open(FILE, "$fulltree");
my @f = <FILE>;
close(FILE);
$temp = $f[0];
($files, $quotause) = split(/ /,$temp); # line 39
}
$sqlnew = "UPDATE tbl_users SET files='$files', quotause='$quotause' WHERE
username='$user'"; # line 41
$sthnew = $dbhnew->prepare($sqlnew);
$sthnew->execute;
}
$dbhnew->disconnect;
$dbh->disconnect;
----
When i run script i recive error:
# ./check-size.pl
: bad interpreter: No such file or directory
When i run perl with option -W say:
# perl -W check-size.pl
Use of uninitialized value in split at check-size.pl line 39.
Use of uninitialized value in concatenation (.) or string at check-size.pl
line 41.
Use of uninitialized value in concatenation (.) or string at check-size.pl
line 41.
Use of uninitialized value in split at check-size.pl line 39.
Use of uninitialized value in concatenation (.) or string at check-size.pl
line 41.
Use of uninitialized value in concatenation (.) or string at check-size.pl
line 41.
Any body can say me where is my error ?
Regards,
Condor
- Next message: Casey West: "Re: Problem when use split"
- Previous message: cAry: "real newbie help needed"
- Next in thread: Casey West: "Re: Problem when use split"
- Reply: Casey West: "Re: Problem when use split"
- Maybe reply: Bob Showalter: "RE: Problem when use split"
- Reply: John W. Krahn: "Re: Problem when use split"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|