On Jun 7, Paul said:

>--- "Robin Lavallee (LMC)" <[EMAIL PROTECTED]> wrote:
>> Then can someone explains why the following code:
>> 
>> #---Begin Code---
>> use strict;
>> my $par="50";
>> print "$par\n";
>> 
>> my @arr = ('first', 'second', 'third');
>> foreach $par (@arr)
>> {
>>      print "$par\n";
>> }
>> print "$par\n";
>> #---End Code-----
>> 
>> produces the following output:
>> 50
>> first
>> second
>> third
>> 50
>
>This I've never noticed. Frankly, I'd like an elaboration on that
>myself. =o)

Please read 'perldoc perlsyn', and note the first paragraph of the section
"Foreach Loops".

-- 
Jeff "japhy" Pinyan      [EMAIL PROTECTED]      http://www.pobox.com/~japhy/
I am Marillion, the wielder of Ringril, known as Hesinaur, the Winter-Sun.
Are you a Monk?  http://www.perlmonks.com/     http://forums.perlguru.com/
Perl Programmer at RiskMetrics Group, Inc.     http://www.riskmetrics.com/
Acacia Fraternity, Rensselaer Chapter.         Brother #734
**      Manning Publications, Co, is publishing my Perl Regex book      **

Reply via email to