#!/usr/bin/perl -w #use strict; #while () { while () { open(F, "cat $_ | pgp +batchmode +force +verbose=0 -f -z \"not much\" 2>/dev/null |"); while (){ if (/(BATCH .*)( 199. | 200. )/) { $year = $2; # print "\n\nSTART".$year."END\n\n"; } if (/SALE .*/) { unshift @a, $&; } } $bob = shift @a; print "$bob 123\n"; print $bob.$year while (defined($bob = shift @a)); }