I don't think you can really mess much with the datalink
layer (layer-2) from an application program as most of that
is generally set by your network interface hardware
or your OS's networking layer.
However, you should be able to do just about anything you want at
layer 3 (network layer) and above. Technically, sockets actually don't exist
until layer-4 (transport) of IP. However, the
Sockets perl module really starts
at layer-3 (netwoking), so you're probably out-of-luck
trying to use it to work at layer-2 (datalink).