in reply to perl one-liner
$1 doesn't do what I think you think it does. In Perl, what you're calling $1 is called $ARGV[ 0 ]. Perl's $1 is used to refer to the first of a regular expression's "captured" matches. See perlretut and perlre.
Anyway, if I'm guessing correctly what you have in mind, and I am the happy beneficiary of a typical Unix shell, and I want to use perl to do this, I'd do:
perl -le 'print q{hello)' > test.pl
the lowliest monk
|
|---|