http://www.perlmonks.org?node_id=1004407


in reply to s/// + tr/// when perl -ni -e on semi-colons in one liners echoed to files

You could feed this string to perltidy:
$ perltidy my $fs = q!.\funkisym.pm!;open(FUNKISYM, q(>),qq($fs)); my $flashbang += q{#! \usr\bin\perl};my $pra = q!use strict;!; my $pra2 = q!use warn +ings;!;my @fstr = (q(format FUNKISYM = ),q(@).q(<) x 16,q($flashbang +).qq(\n),q(@).q(<) x 11,q($pra),q(@).q(<) x 13,q($pra2),qq(.\n));eval +(join($/,@fstr));select FUNKISYM;write;exec(qq!notepad\.exe $fs!); ^D my $fs = q!.\funkisym.pm!; open( FUNKISYM, q(>), qq($fs) ); my $flashbang = q{#! \usr\bin\perl}; my $pra = q!use strict;!; my $pra2 = q!use warnings;!; my @fstr = ( q(format FUNKISYM = ), q(@) . q(<) x 16, q($flashbang) . qq(\n), q(@) . q(<) x 11, q($pra), q(@) . q(<) x 13, q($pra2), qq(.\n) ); eval( join( $/, @fstr ) ); select FUNKISYM; write; exec(qq!notepad\.exe $fs!);
(in this example ^D is used to end the input data; in Windows you'll need to use ^Z)
Edit: correct input data and usage example
Sorry if my advice was wrong.
  • Comment on Re: s/// + tr/// when perl -ni -e on semi-colons in one liners echoed to files
  • Download Code