Last active
March 18, 2019 00:09
-
-
Save chrispetrou/af3dea64fe89b66b5ec8c50e75e69363 to your computer and use it in GitHub Desktop.
Random MAC address generator, implemented in perl...
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl -w | |
use v5.28; | |
use strict; | |
sub genMAC { | |
my $mac; $mac .= sprintf("%x", rand 16) for 1..12; | |
$mac =~ s/(..)/$1:/g; | |
return $mac =~ s/:$//r; | |
} | |
if (@ARGV) { say &genMAC for (1..$ARGV[0]); } | |
else { say &genMAC; } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment