in reply to use of <STDOUT>

How about just using back-tick? return `pwd`;

Since this sort of thing is done so often, the "back-tick" quote-mark causes the enclosing command to be executed and the result returned as a character string. Your entire subroutine becomes ... unnecessary.   :-O

On my keyboard, this character (along with tilde "~") is located on the upper-left side, to the left of the numeral-"1" key.

“This is Perl. There is more than one way to do it.™ ”

Replies are listed 'Best First'.
Re^2: use of <STDOUT>
by Fletch (Bishop) on Mar 06, 2008 at 23:11 UTC

    And some of the ways don't involve calling an external utility; c.f. Cwd, POSIX (specifically getcwd therein).

    The cake is a lie.
    The cake is a lie.
    The cake is a lie.

      I would normally use cwd(). Strangely, when I am running the Perl interpreter that comes with cygwin installation, cwd() never seems to return anything...