I have this code chunk somewhere in a program I'm writing:
sub display { my $file = shift; my $plaintext = `gpg --decrypt $file`; open PAGER, "|less"; print PAGER $plaintext; close PAGER; }
gpg decrypts the file, I get the plaintext in $plaintext. Then I pipe it into less and less displays it fine. But the problem is that when the user exits less, the whole program quits with a "Broken pipe".
How can I solve that problem? No, I don't want to use the shell and simply write `gpg --decrypt $file | less`.
In reply to How to page some text by nomis80
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |