On May 24, 5:36 am, [EMAIL PROTECTED] (Ben Edwards) wrote:
> 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 
> usehttp://www.gurtlush.org.uk/profiles.php?uid=4
> (email address this email is sent from may be defunct)

Is that a trick question?  :-)

(As others have mentioned ...)

use warnings;
use strict;

my $publisher = "pub";
my @files = ( 1, 2, 3 );
delete_from_publishers( $publisher, @files );

#sub remove_files_from_ftp_server {
sub delete_from_publishers {
    my( $publisher, @files ) = @_;
    print "Publisher: $publisher\n";
    print "Files: @files\n";
}

You probably want to read perldoc perlsub again.

Honestly, posting actual working code doesn't take that
much extra effort.

Cheers,

--
Brad


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to