in reply to Showing implicit variables?

B::Deparse does a pretty good job for me:
$ cat ./746989.pl my $filename = shift; if ($line = /something/) { } foreach (@arr) { if (/abc/) { print; } } sub foo { my $x = shift; } $ $ perl -MO=Deparse ./746989.pl my $filename = shift @ARGV; if ($line = /something/) { (); } foreach $_ (@arr) { if (/abc/) { print $_; } } sub foo { my $x = shift @_; } ./746989.pl syntax OK $ $ perl -v This is perl, v5.8.5 built for x86_64-linux-thread-multi

Did you really mean $line =~ /something/?

Replies are listed 'Best First'.
Re^2: Showing implicit variables?
by szabgab (Priest) on Feb 27, 2009 at 23:15 UTC
    Oh this is funny. The original question I wanted to post was only about this code:
    if ($line = /something/) { }
    that I checked with B::Deparse and which did not show the implicit use of $_. The other examples (the implicit use of @_ and @ARGV) I added only to the post and did not test it. I should have done it before posting.

    So yes, those work for me as well but the one I originally wanted does not work.

    My intention was to ask about the various places where implicit variables are used. As I can see B::Deparse shows @_ and @ARGV but does not show the use of $_.

    So let's see if there is a tool that can show the $_ where it is used implicitly?