in reply to One for the regexp fans
The nice thing about perl is that it allows you to code in a manner that simulates speech. You said something like, "I want to split up the address at the dots, prefix zeros to single digit hex values, and join it all together to make a value." Which, incidentally, is exactly what the above one-liner does.$mac = join '', map { /^([0-9a-f])$/i ? "0$1" : $_ } split /\./, $addr +;
|
---|
Replies are listed 'Best First'. | |
---|---|
RE: (Adam: JoinMapSplit) RE: One for the regexp fans
by Anonymous Monk on Aug 05, 2000 at 01:44 UTC | |
by PrakashK (Pilgrim) on Aug 05, 2000 at 02:11 UTC | |
by PrakashK (Pilgrim) on Aug 05, 2000 at 02:10 UTC |
In Section
Seekers of Perl Wisdom