From perldoc print:
If you're storing handles in an array or hash, or in general whenever you're using any expression more complex than a bareword handle or a plain, unsubscripted scalar variable to retrieve it, you will have to use a block returning the filehandle value instead
So, this works fine:
#!/usr/bin/env perl use strict; use warnings; my $hr = { logfh => \*STDOUT }; print { $hr->{'logfh'} } "Hello Hashref\n"; my $obj = bless ($hr, 'UNIVERSAL'); print { $obj->{'logfh'} } "Hello Object\n";
In reply to Re: Object property not legal as direct object?
by hippo
in thread Object property not legal as direct object?
by Daniel Beardsmore
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |