Cleaning the content of log files

Hi,

I am facing problems while trying to clean a log file(Means making its file Size zero).
I am not the owner of this file. From the command line, I can clean it by becoming a Sudo. (">logfilename").

I want to automate it using perl. But inside a script, sudo somehow doesnt seem to work.

Since I have to do this operation several times in the programs, its inconvenient to the the "Sudo" package provided by Perl as I need to set all the values of the Sudo structure everytime with different parameters.

The Sudo package is like this:

use Sudo;
my $su;

$su = Sudo->new(
{
sudo => '/usr/bin/sudo',
sudo_args => '...',
username => $name,
password => $pass,
program => '/path/to/binary',
program_args => '...'
}
);

$result = $su->sudo_run();

So, setting the atrributes of Sudo object everytime is inconvenient.

Is there any work around for it? I am using a BSD box and using bash as my shell.

Thanks,
Jyoti

why not setup the script first and then have that installed in sudo with all the appropriate controls? then you only need to run one script ...

just a thought ...