Hi Charles,

On Thu, Jan 27, 2011 at 20:26, C.DeRykus <dery...@gmail.com> wrote:
> On Jan 27, 1:51 am, r....@aist.go.jp (Raymond Wan) wrote:
>> I was wondering if there is a way for Perl to give me a warning if I
>> redeclare a variable in a different scope (and thus masking the outer
>> one).  Just spent some time debugging this (which was obviously not my
>> intention to give two variables the same name)...and I guess it is a
>> silly mistake that I would do again and again.  :-)
> Not that I'm aware of but you could use B::Xref  to
> generate a cross reference.
>
> perl -MO=Xref -wle 'my $foo=0; { my $foo = 1; }'
> ...
>      $foo              i1, i1      <---- 2 instances of '$foo'


Thank you for your suggestion!

Oddly enough, when I run B::Xref through my scripts, I get
"segmentation faults"  I don't know if I'm using it incorrectly -- but
on a simple Perl file, it works ok.  And of course, it works ok with
your one liner above.

Hopefully it isn't a problem with my scripts -- which seem to be
running ok...  Thank you!

Ray

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to