$Bill Luebkert wrote: > Suresh Govindachar wrote: > >> Thanks for @{[]} -- it is better than evaluating outside the >> here doc. This is because the expressions I need to evaluate >> are fairly complex and the variables involved come from hashes. >> Moreover, I would like to do assignments inside the here doc >> that do not show up in $stuff at all, for example: >> >> |my $foo = 3; >> |my %boo=(); >> | >> |my $stuff = <<EOD; >> | @{[eval{$boo{hoo1}=5; "remove_me";}]} >> | Twice $foo is @{[2 * $foo]} >> | Second line >> | @{[eval{$boo{hoo2}=2; "remove_me";}]} >> | Third line says that \$boo{hoo1} is $boo{hoo1}. >> |EOD >> | >> |$stuff =~ s/\s*remove_me\s*$//gm; >> >> What is the name for the @{[]} thingie -- how can it be found >> in perldoc? And is there a way to avoid the remove_me part? > > perlfunc scalar > perlref near end of "Using References" just before "Symbolic references"
I was concerned that I would not be able to remember @{[]} when I next needed it, but the preceding reference explains how @{[]} works and so makes it easy to remember. Thanks for the precise references. > "remove_me" => '' would be the simple way. You're getting the > eval result back and have to drop it. Returning '' works if the here-doc has good stuff to the left of the @{[]}. But when @{[]} is all by itself, use of '' results in the here-doc having white lines that are not easily distinguished from actual white lines in the here-doc. (I tried returning '\b\b' but it didn't help.) --Suresh _______________________________________________ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs