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

Re: Passing arguments to subroutine

Thread Previous
From:
Jonathan Lang
Date:
May 31, 2007 05:51
Subject:
Re: Passing arguments to subroutine
Message ID:
ef30550b0705310551p7ec2a58cg3ee93d151b56689d@mail.gmail.com
Alma wrote:
> Hi All,
>
> I need to pass the result of prepare statement as an argument to the
> subroutine.
-snip-
> 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


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About