Oracle Function Needed

Dear Experts,
Please find below the script in perl and can any body convert this script exactly in to oracle 9i fiunction which will return the required result same as perl.

#!/usr/bin/perl
$nof=@ARGV;


@var2 = ();

for($n=0; $n<$nof; $n++)
{
        $filename = @ARGV[$n];
        open (input, "<$filename");
        while(<input>)
        {
                chomp;
                @var3 = split(',',$_);
                $cnt_var3 = @var3;
                if(@var3[2] eq '501')
                {
                        if($cnt_var3 eq '214')
                        {
                                for($i=0,$j=27; $i<15; $i++)
                                {
                                        @var2[$i]+=@var3[$j];
                                        $j = $j + 13;
                                }
                        }
                        else
                        {
                                for($i=0,$j=27; $i<15; )
                                {
                                        @var2[$i]+=@var3[$j];
                                        $k = $j + 5;
                                        if(@var3[$k] eq '|')
                                        {
                                                $j = $j + 11;
                                        }
                                        else
                                        {
                                                $j = $j + 13;
                                                $i++;
                                        }
                                }
                        }
                }
        }
        close (input);
}

$sum = 0;
for($i=0; $i<15; $i++)
{
        print "@var2[$i],";
        $sum+=@var2[$i];
}
print "$sum\n"

Thanks

hi
any updates?

What does the input look like? What should the output be?
If you are going to read files, you have to make sure that you have permissions to read file systems from Oracle - which only a DBA can set up.

What have you tried so far?

I'd recommend asking people on an Oracle specific forum for the answer to this.

Oracle has a DBA-specified startup parameter called utl_file_dir which tells Oracle to use that directory only for file input/output for packages (functions, triggers, etc) running inside that instance of Oracle.

Plus as SFNYC, mentioned it is impossible for someone here to port the perl code based the above to an Oracle db function. It is a fairly major deal in terms of schema information, input output required, etc. You need an Oracle forum.