i know of perl compiler back-end allows convert one-liner script on following matter:
perl -mo=deparse -pe 's/(\d+)/localtime($1)/e' which give following output
line: while (defined($_ = <argv>)) { s/(\d+)/localtime($1);/e; } continue { print $_; } is there possibly reverse tool, usable command-line, provided full script generate one-liner version of it?
note: above example taken https://stackoverflow.com/a/2822721/4313369.
perl free-form syntax language clear statement , block separators, there nothing preventing folding normal script single line.
to use example in reverse, write as:
$ perl -e 'line: while (defined($_ = <argv>)) { s/(\d+)/localtime($1);/e; } continue { print $_; }' this rather contrived example, since there shorter , clearer way write it. presumably you're starting scripts short , clear should be.
any use statements in program can turned -m flags.
obviously have careful quoting , other characters special shell. mention running on remote system, assume mean ssh, means have 2 levels of shell sneak escaping through. can tricky work out proper sequence of escapes, it's doable.
this method may work automatically translating perl script on disk one-liner:
$ perl -e "$(tr '\n' ' ' < myscript.pl)" the perl script can't have comments in it, since comment out entire rest of script. if that's problem, bit of egrep -v '\w+#' type hackery solve problem.
Comments
Post a Comment