zitic has asked for the wisdom of the Perl Monks concerning the following question:
Hi everyone!
I have some problems with perl subroutines, or being more specific, I cannot figure out why they are not working as they should.
Here is a tiny code snippet as a sample:sub doubleWord($word) { return $word.$word; } print &doubleWord('hello');
I was hoping that output would be the string 'hellohello', but turns out there is no output at all. I run the script and nothing happens. No errors, no warnings, nothing.
Where is the catch or what am I doing wrong? I'd really like to understand the subroutine's logic.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Subroutine's behavior
by keszler (Priest) on Nov 23, 2009 at 01:15 UTC | |
Re: Subroutine's behavior
by tford (Beadle) on Nov 23, 2009 at 01:38 UTC | |
Re: Subroutine's behavior
by toolic (Bishop) on Nov 23, 2009 at 01:31 UTC | |
Re: Subroutine's behavior
by doug (Pilgrim) on Nov 23, 2009 at 14:47 UTC |
Back to
Seekers of Perl Wisdom