in reply to That rewrite feeling...
I once took a shot at writing a user-side linux device driver in perl. It was heavy on bit twiddling, and was the only time I ever called ioctl. Some of it worked, but it foundered on unpacking long long's in a 32-bit perl.
The device was perfctr. I'd have done better to access the C lib, but I wanted to see how far I could get with pure perl. Some pieces of that projuct are posted here.