$0 should not be trusted.
But if it's just about being short, I'll try too:
open F,$0;open O,">$$.pl";print O while <F>
Or, cheating and even less secure:
open O,">$$.pl";print O `cat $0`
Cheating even more:
`cp $0 $$.pl`
The same, but secure (if cp can be trusted):
exec'cp',$0,"$$.pl"
2;0 juerd@ouranos:~$ perl -e'undef christmas'
Segmentation fault
2;139 juerd@ouranos:~$
|