Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

Re^3: Insert colons into a MAC address

by GotToBTru (Prior)
on Jan 13, 2012 at 21:23 UTC ( #947832=note: print w/replies, xml ) Need Help??

in reply to Re^2: Insert colons into a MAC address
in thread Insert colons into a MAC address

>perl -wMstrict -le 'my $ma="525400eb8b36"; $ma =~ s/..\K\B/:/g; > print $ma; ' Unrecognized escape \K passed through at -e line 1. 525400eb8b36 >
Old Perl Version syndrome, I guess.

Replies are listed 'Best First'.
Re^4: Insert colons into a MAC address
by AnomalousMonk (Chancellor) on Jan 14, 2012 at 08:57 UTC
    Old Perl Version ...

    Indeed. The  \K special escape was introduced with 5.10. The following works pre-5.10, but we're back to a look-back. Oh, well...

    >perl -wMstrict -le "print $]; my $ma = '525400eb8b36'; $ma =~ s{ (?<= \G ..) \B }{:}xmsg; print qq{'$ma'}; " 5.008009 '52:54:00:eb:8b:36'

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://947832]
[Corion]: ambrus: He isn't familiar with GIGO (or nIGO) yet?
[Corion]: Also, is it impossible in the general case, but doable in your specific case, maybe? I find that working through a counterexample usually makes people see the light
[Corion]: Uiiih! Let's Encrypt will start issuing wildcard certificates, that's cool!
[ambrus]: Corion: no, backwards. It's possible in the general case, but not in the specific case of bad data we have. Which is why it's harder to explain.

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (7)
As of 2017-12-12 13:07 GMT
Find Nodes?
    Voting Booth?
    What programming language do you hate the most?

    Results (332 votes). Check out past polls.