in reply to getting a subroutine's name
It doesn't return anything, because nothing has been called. Only defined.
Try
calling();
That said...
#works fine sub addem{ ($value1, $value2)=@_; $value1+$value2; print join(':',caller); ($package, $filename, $line)=caller; }
...will return 3 for any values you add. You are adding the two values passed and throw away the result. Then you return a list of three items (the last value evaluated in that subrouttine) - $package, $filename, $line - which in scalar context results in the number of elements in that list: 3.
Works fine? Not.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: getting a subroutine's name
by biohisham (Priest) on Jul 17, 2009 at 18:59 UTC | |
by shmem (Chancellor) on Jul 17, 2009 at 19:20 UTC | |
by biohisham (Priest) on Jul 17, 2009 at 19:52 UTC |