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

Passing multiple mixed arguments to subs

Thread Next
From:
Ben Edwards
Date:
May 24, 2007 02:37
Subject:
Passing multiple mixed arguments to subs
Message ID:
32b873ff0705240236t6bd0893bh7872fe319fb404ab@mail.gmail.com
I am passing a reference to a hash ($publisher) and a array with an
unknown number of elements (@files).  So the call is

delete_from_publishers( $publisher, @files )

Currently the beginning of the sub is:-

sub remove_files_from_ftp_server {
  my $pub_detail = $_[0];
  my $args       = @_;
  my @files      = @_[1..($args-1)];

This works fine but is a bit messy.  Is there a better way of acheving
the same result?

Regards,
Ben
-- 
Ben Edwards - Bristol, UK
If you have a problem emailing me use
http://www.gurtlush.org.uk/profiles.php?uid=4
(email address this email is sent from may be defunct)

Thread Next


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