How are you calling the convert() routine? You're
declaring a no-arguments prototype (i.e. the empty parentheses), but are then assigning my @array = @_; (presumed
to be arguments) at the beginning of the routine. This doesn't make much sense.
Similarly, printing something after the return ... :)
Update: BTW, you could also use unpack to simplify
the function, e.g. something like
my @mac_addrs = ("0015FAA3F03A", "0015FAA3F03B", "0015FAA3F03C");
sub convert {
return map { "AP" . join ".", unpack "(A4)*", lc $_ } @_;
}
print "$_\n" for convert(@mac_addrs);
Output:
AP0015.faa3.f03a
AP0015.faa3.f03b
AP0015.faa3.f03c