in reply to UNIX shell scripts + pipes
hello.pl#! /usr/bin/perl -w use strict; my @program1 = `perl ./hello.pl`; foreach (@program1) { # pass to program2 &program2($_); } sub program2() { # value from program1 my $value = shift; my @newvalue = `echo $value | perl ./chopup.pl`; foreach (@newvalue) { print $_; } }
chopup.pl#! /usr/bin/perl -w use strict; my $message = "Hello Lucy!"; print "$message";
Run ./start.pl and all files will be processed. I hope this helps, or maybe I should say I hope my understanding is correct! ;#! /usr/bin/perl -w use strict; chomp (my $value = <STDIN>); my @value = split "",$value; my $count = @value; my $i; for ($i=0;$i<$count;$i++) { print "\@value[$i] = $value[$i]\n"; }
|
|---|