yitzle wrote:
> What are you trying to accomplish?
> What is @files? Did you define it somewhere? Or is it a Perl global
> var I don't know of?
>
>   
The below is speculation since these questions need to be answered.  In
addition to what is @files I'd add what is $Tmp?
> On 10/19/07, Joseph L. Casale <[EMAIL PROTECTED]> wrote:
>   
>> I had the following code:
>>
>> open (FILEOUT, "> $OutDir/info") or die $!;
>> print FILEOUT "text         =              abc\n";
>> my $Tmp = ++$#files;
>> print FILEOUT "moretext              =              $Tmp\n";
>>
>> When I add the 3rd line, it initializes the files array and I can't use it 
>> after? Why is that?
>>     
I actually guessed the code to be trying to go one way but am now
changing my guess.  Don't say "initialize" when you don't mean it, that
implies that the variable previously contained no value. 

>> I now have:
>>
>> open (FILEOUT, "> $OutDir/info") or die $!;
>> print FILEOUT "text         =              abc\n";
>> print FILEOUT "moretext              =              " . @files . "\n";
>>
>> And not only does that work, it also shows the real size of the array? I'm 
>> confused :)?
>>
>> Thanks!
>> jlc
>>     
>
>   
If you access an array as a scalar it returns the length of the array. 
In this case it's the only mention of the array so the actual purpose is
enigmatic at the least.  I'm guessing you want to print the array.  If
you're looking for the last element then you could use $file($#files),
if you're looking for the whole thing then either for through it or join
it.   perldoc -fjoin


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to