Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
my $fh; my %x; open($fh, ...) $x{handle} = $fh print $x{handle} "Wow!\n";
I get the error "String found where operator expected" at the print. I can use a temporary variable as a workaround, but that should be unnecessary:
my $z = $x{handle} print $z "Wow!\n";
Perl hashes work just about everywhere else I've used them, so why don't they work with print?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Nonsense error from Perl
by davido (Cardinal) on Oct 15, 2011 at 07:41 UTC | |
|
Re: Nonsense error from Perl
by ikegami (Patriarch) on Oct 15, 2011 at 08:12 UTC | |
|
Re: Nonsense error from Perl
by jwkrahn (Abbot) on Oct 15, 2011 at 07:44 UTC | |
|
Re: Nonsense error from Perl
by Anonymous Monk on Oct 15, 2011 at 07:28 UTC | |
|
Re: Nonsense error from Perl
by Marshall (Canon) on Oct 15, 2011 at 12:20 UTC | |
|
Re: Nonsense error from Perl
by Khen1950fx (Canon) on Oct 15, 2011 at 23:04 UTC |