|laziness, impatience, and hubris|
More Help with Regexby lucky1 (Initiate)
|on Jan 31, 2002 at 14:19 UTC||Need Help??|
lucky1 has asked for the
wisdom of the Perl Monks concerning the following question:
I'm trying to insert colons ':' into a string to represent a MAC address. I'm using join and split...
print join(':', split /(..)/,'00a0c801adc6'),"\n<BR>";
But I get this as my output:
Any idea why I get all the extra colons? My guess is that my regular expression is splitting (and joining) on a match at the start of every octet instead of just the end. How can I stop that from occurring? I've scoured "Programming Perl" and "Perl Cookbook" but can't find any help.