"...
Hi Paul.

n 'our' variable has the same visibility as a 'my' variable declared
in the same place, i.e. through to the end of the current lexical
scope (block or file). Unlike 'my', however, it is a permanent
package variable and its value will be retained across calls to a
subroutine (unless modified elsewhere). It may be accessed
anywhere (even from another package) by fully qualifying it.
.."

The previous example I sent was a bit rough, due to a lack of symmetry in the code.  I 
also structured it to show the way I would use each scope identifier comment.  I say 
comment because I don't see a whit of difference between the actual behaviors.  I just 
tried substituting our for my in the line: "my ($LastName, $MiddleName) = @_;" and it 
behaved in exactly the same way.

Can you show us an example where they bvehave differently?

Thnaks,

Joseph


#!/usr/bin/perl -w

use strict;

our $FirstName = "Robert";
my $MiddleName = "Joseph";

FeedSub($MiddleName);
sub FeedSub {
  my $MiddleName = $_[0];
  my $LastName = "Newton";

  for (1...4) {
    TestIt($LastName, $MiddleName);
   print "$FirstName\n";
   print "$MiddleName\n";
   print "$LastName\n";
  }
}

sub TestIt {
  my ($LastName, $MiddleName) = @_;
 $MiddleName .= '_';
 $FirstName .= '_';
 print "$FirstName\n";
 print "$MiddleName\n";
 print "$LastName\n";
}



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to