There's more than one way to do things | |
PerlMonks |
Re: Help me decipher code containing map functionby AnomalousMonk (Archbishop) |
on May 20, 2017 at 04:54 UTC ( [id://1190695]=note: print w/replies, xml ) | Need Help?? |
What BrowserUk said. And if for some reason you really want the address in two-byte groups:
Update: Why do i get an error when I start my code like "map { my $val .=" instead of declaring $val separately.Because if your code were map { my $val .= sprintf("%02x",$_) } unpack "CCCCCC", $octetstr; $mac=join(".",unpack("a4 a4 a4",$val)); then the $val lexical scoped within the map block is entirely local to the map block and does not exist outside of it, so the $val variable in the $mac=join(...,unpack(...,$val)); statement is undeclared and is a syntactic error under strict (if that's the error you're getting) — unless you have an unrelated $val declared somewhere, which would be a semantic error. Give a man a fish: <%-{-{-{-<
In Section
Seekers of Perl Wisdom
|
|