I think you will be able to do this in Perl 6:
sub beep ($text) is inline { print $LOG "BEEP: $text\n"; }
I've seen examples of this (is inline) for custom operators on the perl6-language list.
Comment on Re: Re: Specific Examples? - Re: A Macro System for Perl?