Created
April 15, 2022 11:50
-
-
Save Gro-Tsen/87fae2262cc7c028bba664903bff906b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/local/bin/perl -w | |
use strict; | |
use warnings; | |
for ( my $i=0 ; $i<5 ; $i++ ) { | |
my $var; | |
sub returnvar { return $var; } | |
$var = $i; | |
print "\$i=$i, \$var=$var, returnvar returns ", returnvar, "\n"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
20 years is actually surprisingly recent given that lexical scoping has been standard and well-known since ALGOL-60 and was the major change between Lisp 1 and Lisp 1.5 in 1962. 😝