in reply to Re^3: parse lisp style config
in thread parse lisp style config

It can break bad exactly because of scope. The variables declared in the outer sub are not properly shared to the inner subs (or rather, they are shared only in the first run).
#!/usr/bin/perl use strict; use warnings; sub outer { my ($x) = @_; sub inner { return $x + 1 } return inner() } print outer(12), "\n"; # 13 print outer(42), "\n"; # 13 !!

Also, you'll get a warning:

Variable "$x" will not stay shared at 1.pl line 9.

map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]

Replies are listed 'Best First'.
Re^5: parse lisp style config
by vincentaxhe (Scribe) on Nov 29, 2024 at 01:41 UTC
    I got the warning, if passed by arg, it's ok, thanks for explained the meaning for me.