Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Corrupt Data?

by almut (Canon)
on Jul 14, 2008 at 19:37 UTC ( [id://697546]=note: print w/replies, xml ) Need Help??


in reply to Corrupt Data?

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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://697546]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (2)
As of 2024-04-26 06:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found