in reply to variable name

I'm not sure why you want to use that, but there is a way to find the variable names, and that's by checking the symbol table (hash %::) but it contains symbols you don't want... here's an example to filter them out:

$bleh = 1; $var = 3; print join "\n", grep { ! ( /^\*/ || /(::|\W)/ ) } grep { ! /(std(err|out|in)|ARGV|INC|ENV|0|STD(ERR|OUT|IN)|_)/ } keys %::;

So now you have all the variable names in the script (in package main here) but finding out which variable is which it tricky.

--
Leviathan.

Replies are listed 'Best First'.
Re^2: variable name
by polypompholyx (Chaplain) on Jul 22, 2006 at 13:10 UTC
    That won't work with lexical (my) variables as in the OP's example: these don't appear in the symbol table: see what happens if you change your $bleh to  my $bleh.