can not print
# works (of course ...)
$var = 'id1';
open $var, '>oooooooooooooo' or die;
print $var 'hello world';
close $var;
# also works (of course ...)
$hash->{fileid} = 'id1';
open $hash->{fileid}, '>oooooooooooooo' or die;
print id1 'hello world';
close $hash->{fileid};
# This does not work (the one I need) . I think it is a perl bug.
# Any idea ?
$hash->{fileid} = 'id1';
open $hash->{fileid}, '>oooooooooooooo' or die;
print $hash->{fileid} 'hello world';
close $hash->{fileid};
Re: can not print
George Bouras wrote:
> # This does not work (the one I need) . I think it is a perl bug.
> # Any idea ?
Several. None of them overly polite... ;-)
> $hash->{fileid} = 'id1';
> open $hash->{fileid}, '>oooooooooooooo' or die;
> print $hash->{fileid} 'hello world';
> close $hash->{fileid};
Before assuming that you know what you're doing and Perl does not,
consider reading the documentation for the function you're using
perldoc -f print
<snip>
Note that if you're storing FILEHANDLES in an array
or other expression, you will have to use a block
returning its value instead:
print { $files[$i] } "stuff\n";
print { $OK ? STDOUT : STDERR } "stuff\n";
Paul Lalli