On Tuesday 04 May 2010 at 16:28, Parrot wrote:
> it seems to me that
> {{{
> open( my $OUT_FH, '>', "${MOD_BUILD_PATH}$item_list_ref->[$_[0]][0]" );
> }}}
>
> has {{{my}}} incorrectly scoped, so a "Useless use of constant in void
> context" warning is emitted. i see no other reason for that code to fail.
That shouldn't be the case; this is perfectly valid Perl syntax since Perl
5.6.0.
> try
>
> {{{
> open( my ($OUT_FH), '>', "${MOD_BUILD_PATH}$item_list_ref->[$_[0]][0]" );
> }}}
>
> or better yet, don't declare a variable inside an op parameter list, do it
> first:
>
> {{{
> my $OUT_FH;
> open( $OUT_FH, '>', "${MOD_BUILD_PATH}$item_list_ref->[$_[0]][0]" );
> }}}
I suspect that the real problem was:
{{{
print $OUT_FH;
}}}
... which the Perl 5 parser can't distinguish between printing the contents of
the variable to the currently selected filehandle or printing $_ to the lexical
filehandle stored in $OUT_FH. r46292 fixes that with:
{{{
print $OUT_FH $_;
}}}
-- c
_______________________________________________
parrot-tickets mailing list
[email protected]
http://lists.parrot.org/mailman/listinfo/parrot-tickets