How to pass file to perl script for processing and also use heredoc syntax for multi-line perl script? I have tried those but no luck:
cat ng.input | perl -nae <<EOF
if (@F==2) {print $F[0] . "\t". $F[1] . "\n"} else { print "\t" . $F[0] . "\n" }
EOF
cat ng.input | perl -nae - <<EOF
if (@F==2) {print $F[0] . "\t". $F[1] . "\n"} else { print "\t" . $F[0] . "\n" }
EOF
perl -ple'$_="\t$_"if!/\t/'(if @F!=2 when @F<2, and if the input is specifically tab separated rather than whitespace separated)