rose has asked for the wisdom of the Perl Monks concerning the following question:
Hi Monks,
I have few confusion is as follows. It would be very helpfull if you clear.
I have perl file name a.pl
#!/usr/local/bin/perl use b; MAIN: { my $value; b::test($value); print "\nVALUE = $value\n"; }
b.pm has following code.
package b; print "\nINSIDE-PACKAGE\n"; sub test { my ($value) = @_; $value="This is value return from sub\n"; return $value; ## If I comment this } 1;
This code is working well and the return $value also printing.
My doubt is, if I comment return $value;, the return will not print. Is there any option to print if I don't use return
Please sugget me..
Thanks!!!
Rose
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Return Value in Subroutine
by ikegami (Patriarch) on Jul 16, 2007 at 16:44 UTC | |
by citromatik (Curate) on Jul 16, 2007 at 16:59 UTC | |
|
Re: Return Value in Subroutine
by Ploux (Acolyte) on Jul 16, 2007 at 17:41 UTC |