i am trying to download a file using Perl script but it is not working,
$u='http://www.example.com/dir/files/myfile.csv';
`wget -O $filename $u`;
i've tried this code but it gives me an error 403 forbidden.
The most common case is that you need some kind of authorization to access the file. Apart from that there are systems which block access to content if the client does not look like a typical browser, i.e. wrong user-agent, missing or different HTTP headers etc.
More information can probably not given based on the few information you provide. I recommend to try to access the file with a normal browser and if it does not work even there you have probably no authorization to access the data.
Apart from that, since all you do with Perl is to call the wget command this issue has not really a relation to Perl.