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

Passing multiple mixed arguments to subs

Thread Next
Ben Edwards
May 24, 2007 02:37
Passing multiple mixed arguments to subs
Message ID:
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?

Ben Edwards - Bristol, UK
If you have a problem emailing me use
(email address this email is sent from may be defunct)

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