my $rin = "";
vec($rin, fileno(STDIN), 1) = 1;
my $isPiped = select($rout=$rin,"","",1);
if($isPiped){
#Do the data processing from pipe
}
####
some-program|myprogram -parameters
####
my $rin = "";
sleep(5);
vec($rin, fileno(STDIN), 1) = 1;
sleep(5);
my $isPiped = select($rout=$rin,"","",1);
if($isPiped){
#Do the data processing from pipe
}