It really depends on what you mean by passing each line to another
program: 1)Do you mean, call another program with each line as the
arguments? or 2) Do you mean, pipe each line to another program's
standard input? (or do you mean something altogether different?)
# 1
#!/usr/bin/perl -w
use strict;
my $other_program = 'echo';
while(<>){
chomp;
system($other_program, $_);
}
__END__
# 2
#!/usr/bin/perl -w
use strict;
my $other_program = 'tr [a-z] [A-Z]';
open(OTHER, "|$other_program") || die "Kant: $!";
while(<>){
print OTHER $_;
}
close OTHER;
__END__