in reply to Idle search for a file-read idiom

perl -ne 'frobinate( $_) ' foobar.txt

or am I missing some constraint you have?

s//----->\t/;$~="JAPH";s//\r<$~~/;{s|~$~-|-~$~|||s |-$~~|$~~-|||s,<$~~,<~$~,,s,~$~>,$~~>,, $|=1,select$,,$,,$,,1e-1;print;redo}

Replies are listed 'Best First'.
Re^2: Idle search for a file-read idiom
by starbolin (Hermit) on Apr 22, 2005 at 16:05 UTC

    Oh, you say you want a longer script. Like from a file.

    #!/usr/bin/perl -wn BEGIN{$num=0}; print ++$num,' ',$_; END{print "\nDo some processing outside of the loop.\n"}

    Prints the file on the command line with linenumbers added and prints a summary.

    s//----->\t/;$~="JAPH";s//\r<$~~/;{s|~$~-|-~$~|||s |-$~~|$~~-|||s,<$~~,<~$~,,s,~$~>,$~~>,, $|=1,select$,,$,,$,,1e-1;print;redo}