@kyanny's blog

キャンベルスープはいつも飲んでいたからね。毎日二十年間、同じランチを食べたものさ - アンディ・ウォーホル


Emacs Lisp Intro で let のページを読んだ。

   Another way to think about `let' is that it is like a `setq' that is
temporary and local.  The values set by `let' are automatically undone
when the `let' is finished.  The setting only affects expressions that
are inside the bounds of the `let' expression.  In computer science
jargon, we would say "the binding of a symbol is visible only in
functions called in the `let' form; in Emacs Lisp, scoping is dynamic,
not lexical."


Emacs Lisp

(defun foo ()
  (message "value of `foo' is %s" foo))
;=> foo

    ((foo "FOO"))
;=> "value of `foo' is FOO"

Perl にただ翻訳すると、こうか?

#!/usr/bin/env perl
use strict;
use warnings;

sub foo {
    printf "value of `foo' is %s", $foo;

    my $foo = "FOO";
# $ perl foo.pl 
# Global symbol "$foo" requires explicit package name at foo.pl line 6.
# Execution of foo.pl aborted due to compilation errors.