Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Can I get the name of a variable passed to a subroutine?

by stefan k (Curate)
on Nov 29, 2001 at 17:23 UTC ( #128339=note: print w/ replies, xml ) Need Help??


in reply to Can I get the name of a variable passed to a subroutine?

Well,
I think I'd turn the logic round: call that routine with the name of the variable:

dBug_showArray("@currTime");
and eval() that string in your subroutine.

Hmm, one major flaw of this would be scoping: you'd need to really know that variable there, and that would mean you'd only be able to show global variables there. Maybe something could be done using closures, but since I don't exactly know what they are/look like I could be wrong.


Comment on Re: Can I get the name of a variable passed to a subroutine?
Select or Download Code
Re: Re: Can I get the name of a variable passed to a subroutine?
by IlyaM (Parson) on Nov 30, 2001 at 23:18 UTC
    It almost useless. Unless you use global vars all time (very bad idea) it doesn't work because of scoping.

    --
    Ilya Martynov (http://martynov.org/)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://128339]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (13)
As of 2014-09-22 12:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (191 votes), past polls