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

Short answer: it is impossible.

Long answer: everything is possible if you really, really want. Take a look at function caller. It returns information about context of the current subroutine call. It can return many things. Among them it can return filename of script and line in it where your subroutine was called. In theory you can open your script, find that line, parse it and find how its arguments have been passed.

Well, by why do you need it? Why just don't add another argument for dBug_showArray - string of message? Something like:

sub dBug_showArray { my $msg = shift; print "\n\n\Value of array '$msg' is:\n"; ... ...

so you can call it as

dBug_showArray("@currTime", @currTime);

Replies are listed 'Best First'.
Re: Answer: Can I get the name of a variable passed to a subroutine?
by IlyaM (Parson) on Nov 29, 2001 at 04:34 UTC
    Update:.

    There is small bug in my code:

    dBug_showArray("@currTime", @currTime);
    It should be
    dBug_showArray('@currTime', @currTime); ^^^^^ ^^^^^
    Thanks to clintp who have noticed it.