my $cmd = "tail -f $0"; open(my $fh, "$cmd |") or die "cannot open pipe: $!"; while (<$fh>) { print; }