$ cat ../domk.pl #!/usr/bin/perl use strict; use warnings; while (<>) { chomp; print "huzzah:".collect( $_ )."!\n"; } sub collect { local *ARGV; @ARGV = @_; join '', <>; } $ ls file? | ../domk.pl huzzah:file1 line1 file1 line2 ! huzzah:file2 line1 file2 line2 !