Skip to content

Instantly share code, notes, and snippets.

@chrispetrou
Last active March 18, 2019 00:09
Show Gist options
  • Save chrispetrou/af3dea64fe89b66b5ec8c50e75e69363 to your computer and use it in GitHub Desktop.
Save chrispetrou/af3dea64fe89b66b5ec8c50e75e69363 to your computer and use it in GitHub Desktop.
Random MAC address generator, implemented in perl...
#!/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