|
|
Question : rmdir
|
|
Hi,
I am doing a project with perl and mysql.
I am getting the lastname of the user and create a directory with that lastname:
mkdir "$lastname";
and I also added that lastname to my table "student".
Now, I am trying to delete that directory by only getting the $id from the user: my $sql = "SELECT lastname FROM student where student_id =$id "; my $sth = $dbh->prepare($sql) or die "cannot prepare"; $sth->execute() or die "cannot execute";
rmdir "$lname";
I know that I should not write "$lname" in the rmdir function, but what should I write there? or is there another way to remove the directory?? How can I assign the value of the retrieved data by that SELECT statement to another scalar value, so that I can write that value inside the rmdir function.?
Thank you
cem
|
Answer : rmdir
|
|
$lname = $sth->fetchrow; rmdir $lname or warn "$lname $!";
|
|
|
|
|