Thanks for your input, people!

Sorry about the lack of code example before. Here's what I've come up with so far:

get_highest_vers(\@vers); sub get_highest_vers { my $vers_index; my @sorted_vers; my @locvers = @_; $#sorted_vers = -1; if ($#locvers == -1) { $highest_vers = 0.00; } else { for ($vers_index = 0; $vers_index <= $#locvers; $vers_index++) { $locvers[$vers_index] =~ s/\.\/v//; $locvers[$vers_index] += 0; } # Sort the archive version numbers and grab the highest one @sorted_vers = sort {$b <=> $a} @locvers; $highest_vers = shift(@sorted_vers); } ($major, $minor) = split(/\./, $highest_vers); }

This seems to work, (although I can't help feeling it's a little ornate!)

Anyway, I'm still having problems when I try and move the subroutine to a seperate module and call it in using the "use Module" construct:

I get a complaint that the argument given in the subroutine call should be an array, not a reference constructor. It also says that no implicit dereferencing is allowed--use the {EXPR} forms as an explicit dereference.

Can anyone advise? BTW, I'm using "diagnostics" and "strict".

-Withnail


In reply to Re: Re: How to determine if an array passed as an argument to a subroutine is zero-length by Withnail
in thread How to determine if an array passed as an argument to a subroutine is zero-length by Withnail

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.