Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Concatenate and join

by Cristoforo (Curate)
on Mar 31, 2016 at 03:54 UTC ( [id://1159179]=note: print w/replies, xml ) Need Help??


in reply to Concatenate and join

Another way using the transliteration operator. Assumes a 12 digit address.
my @outputlist = '28:8a:1c:59:cc:85'; for my $addr (@outputlist) { my $mac_R5 = join ".", $addr =~ tr/://dr =~ /..../g; print $mac_R5, "\n"; }
Update: Changed the transliteration to bind with the regex match. The former line was:

my $mac_R5 = join ".", $addr =~ tr/://d && $addr =~ /..../g;

Which works for perls before version 5.014.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (4)
As of 2024-03-28 21:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found