develooper Front page | perl.beginners | Postings from May 2007

Re: Passing arguments to subroutine

Thread Previous
Jonathan Lang
May 31, 2007 05:51
Re: Passing arguments to subroutine
Message ID:
Alma wrote:
> Hi All,
> I need to pass the result of prepare statement as an argument to the
> subroutine.
> abc is calling delete_file() . where it need to delete the file stored
> at the location mentioned in file_path.
> Its not giving me an error but its not deleting the files from the
> location.

A few thoughts:

1. Where are you setting '&delete_posterfile'; and to what are you setting it?

2. IIRC, following a sub declaration with empty parentheses tells the
compiler that that sub doesn't take any parameters.  Within the scope
of the delete_file sub, @_ is set to '()'; so shifting or assigning
from @_ to a list will always result in null assignments.  Try
removing the '()' from the sub declaration lines.

Jonathan "Dataweaver" Lang

Thread Previous Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About