2009/12/5 Parag Kalra <paragka...@gmail.com>:
> But this code is not working:
>
> #!/usr/bin/perl
>> my @column_names=(A..ZZ);
>> for(my $i=0; $i<26; $i=$i+1) {
>>     my $tmp_file = "$column_names[$i]".".out";
>>     open $column_names[$i], ">column_names/$tmp_file" or die "Could not
>> create the file - $tmp_file \n";
>>     print $column_names[$i] "This is not working\n";

Put the indirect filehandle in curlies:
print {$column_names[$i]} "This is not working\n";

A simple variable can be used "raw" as an indirect filehandle but more
complex expressions must be disambiguated with curlies.

Phil

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to