[Brisbane-pm] Looking for Perl Mongers 2 and a basic question
Martin Jacobs
martin_jacobs at optusnet.com.au
Wed Jan 24 19:12:01 PST 2007
Hi folks
Many thanks to the people who replied to my earlier request for help.
I was pleasantly surprised by such a positive response.
I might add that I live and work in Camp Hill, Brisbane, so an offer
of help near to home would be greatly appreciated. I'll be in contact
with the folks who offered to help shortly.
In the meantime I've got a genuine Perl Query. I asked a friend of
mine in the UK if there was something that would print the same thing
to a number of different 'files', including the computer screen. He
kindly wrote the following;
sub Print_to {
my $rfh = shift;
print $_ @_ or die $! for @$rfh;
}
So that when I code
Print_to [$a, $b] "Smorg";
Perl prints "Smorg" into the files represented by the variables $a
and $b
Note that Perl has already assigned filehandles to $a and $b by
my $a = <FH> ;
etc..
This works just fine in my program.
The query is how do I get it to print the same thing to screen (I
mean to the terminal or command prompt). Is it STDOUT? What's the
syntax for saying 'make $a the output to screen'? My workaround at
present is
Print "Smorg";
Print_to [$a, $b] "Smorg";
which doubles the number of lines in the code.
Regards,
Martin
Visit my website...
http://web.mac.com/martin_jacobs1
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.pm.org/pipermail/brisbane-pm/attachments/20070125/bea25421/attachment.html
More information about the Brisbane-pm
mailing list