#!/bin/sh complex-pipeline-with | perl -x "$0" | while read LINE ; do something-with-output done exit 0 ################### #!/usr/bin/perl -pl use strict; use warnings; # some relatively complex string mangling here