On May 31, 9:27 am, [EMAIL PROTECTED] (Alma) wrote: > Hi All, > > I need to pass the result of prepare statement as an argument to the > subroutine. > > sub abc() > { > my $self= shift; > my($id,$title) = @_; > my $sth1= $databasehandle->prepare("select file_path from xyz > where id='$id' and title like '$title'"); > my $res = $sth1->execute(); > > my @row = $sth1->fetchrow_array; > print @row; > > &deleteposter_file(@row); > > } > > #-----------------Deletes from the File system > > sub delete_file() > { > my $self = shift; > my $file_path = @_; > > # extract the file name > # my @parts = split('\/',$file_path); > # my $file =$parts[$#parts]; > # #unlink($file); > # if( -e "file" ) { > # system("rm $file_path"); > > unlink($file_path); > > }
Your split statement seems to be wrong. split uses a regex to match so it should be: split /\\/, $file_path; I'd also suggest making sure you're in the correct directory to use unlink. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/