in reply to How to display the .pl process in command line
Well, I have a couple recommendations. For one, please organize your code. Remember DRY(Don't Repeat Yourself), there is a lot of code duplication in that snippet. And also think about logically grouping your code. Secondly(and most importantly), I think you want IO::Tee.
use IO::Tee; my $out_handles = new IO::Tee(\*STDOUT, new IO::File('>random_file.txt +')); print $out_handles "*Hey Buddy*\n"; print $out_handles "*I'm on your screen and your file!*\n";
So, essentially, IO::Tee allows you to write to multiple file handles simultaneously.
You could use a second print statement with just a string to accomplish the same result. Or select. Plus a bunch I can't think of right now. Always a lot of choices.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: How to display the .pl process in command line
by astronogun (Sexton) on Mar 27, 2012 at 09:08 UTC | |
by bms (Monk) on Mar 27, 2012 at 09:59 UTC | |
by astronogun (Sexton) on Mar 28, 2012 at 03:28 UTC | |
by bms (Monk) on Mar 28, 2012 at 04:21 UTC | |
by astronogun (Sexton) on Mar 28, 2012 at 03:25 UTC |
In Section
Seekers of Perl Wisdom