in reply to Preprocessing print statements

two alternative approaches:

a) If you are OK with buffering, you can still use select with a filehandle opened to a \$scalar and filter the scalar before printing. This has the advantage of minimal changes.

b) Personally I'd prefer my own out() routine - closing over a regex var - to replace all needed prints. That'll give you finer control over the single print chunks.

HTH

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery

UPDATED: Clarified that these are two different approaches.

Replies are listed 'Best First'.
Re^2: Preprocessing print statements
by mauroid (Initiate) on Nov 11, 2020 at 13:42 UTC

    Thank you. Could you please provide a sample code snippet? I am not entirely clear how to do what you suggest.

        "... straight forward..."

        The classic 24/7 support talk.

        Phone call round midnight:

        Customer: "I got this nose/cuke problem." Support: "Replace nose with cuke. Customer: "But i don't understand!" Support: "The solution is obvious. Good night."

        Situation in the morning AKA aftermath:

        [] All servers shutdown [] All airplanes grounded [] Perlmonks offline [] No transactions today [] All centrifuges bursted [] Don T. stays in office

        Whatever could happen. But then you are fired.

        «The Crux of the Biscuit is the Apostrophe»

        perl -MCrypt::CBC -E 'say Crypt::CBC->new(-key=>'kgb',-cipher=>"Blowfish")->decrypt_hex($ENV{KARL});'Help