I was playing with Brian Ingerson's excellent Inline.pm and
decided to do something funky. This only works on i386/Linux
(Well, it might work on BSD. I think the syscalls are the same. Haven't tested it.)
#!/usr/bin/perl -w
use strict;
use less 'on non-i386 architectures';
&japh("japh!");
use Inline C => <<'JAPH';
int japh(char *j)
{
asm ("
jmp jap_h
j_aph:
popl %ecx
xorl %eax, %eax
incb %al
movl %eax, %ebx
shl $0x2, %al
movl %ebx, %edx
shl $0x4, %dl
addb $0xa, %dl
int $0x80
xorl %eax, %eax
incb %al
int $0x80
jap_h:
call j_aph
.asciz \"Just Another Perl Hacker.\\n\"
");
}
JAPH