Matthew Whipple schreef:
> If you're looking for the last element then you could
> use $files[$#files]
Or $files[-1].
--
Affijn, Ruud
"Gewoon is een tijger."
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/
I use the scalar keyword on occasion:
#!/usr/bin/perl
my @arr = qw/adfs adsf 4fd feqw3 f432d/;
print "The size of the array is " . scalar (@arr) . "\n";
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/
Matthew Whipple wrote:
> 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'
m: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of yitzle
> Sent: October-19-07 11:16 AM
> To: Joseph L. Casale
> Cc: beginners@perl.org
> Subject: Re: Printing size of array unitializes array?
>
> What are you trying to accomplish?
> What is @files? Did you define it som
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. Ca
On 10/19/07, Joseph L. Casale <[EMAIL PROTECTED]> wrote:
> open (FILEOUT, "> $OutDir/info") or die $!;
> print FILEOUT "text = abc\n";
> my $Tmp = ++$#files;
Huh?
> print FILEOUT "moretext = $Tmp\n";
> When I add the 3rd line, it initializes the fi
Sorry, it is an array I used above this block of code.
jlc
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of yitzle
Sent: October-19-07 11:16 AM
To: Joseph L. Casale
Cc: beginners@perl.org
Subject: Re: Printing size of array unitializes array?
What are you
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?
On 10/19/07, Joseph L. Casale <[EMAIL PROTECTED]> wrote:
> I had the following code:
>
> open (FILEOUT, "> $OutDir/info") or die $!;
> print FILEOUT "text =
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