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
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>