Here comes the code that doesn't work:
Now here is the bug (it is really a bug?) the print $self-{fh} "whatever"; brings up the error:package Player; my %players = (); sub new { my $package = shift; my $self = bless { mux => shift, fh => shift } => $package; # Register the new player object as the callback specifically for # this file handle. $self->{mux}->set_callback_object($self, $self->{fh}); print $self->{fh} "Greetings, Professor. Would you like to play a +game?\n"; ...
After changed it to:String found where operator expected at server.pl line 42, near "} "Gr +eetings, Professor. Would you like to play a game?\n"" Missing operator before "Greetings, Professor. Would you like to play + a game?\n"?) syntax error at server.pl line 42, near "} "Greetings, Professor. Woul +d you like to play a game?\n""
all is fine.my $fh = $self->{fh}; print $fh "Greetings .....";
The question is now, is this in general not possible to print to a hash-stored-handle by deref it during the print command, or am I missing something ?
Thnx
----------------------------------- --the good, the bad and the physi-- -----------------------------------
In reply to print on a hash-stored-handle by physi
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |