in reply to Re: Print Vs Return In a Subroutine
in thread Print Vs Return In a Subroutine
Take a look at this code:
This will produce this output:#perl my $variable = 234; sub ax { print $variable; print "\n"; } sub bx { $variable; } my $return_val_a = ax(); print "a - [$return_val_a]\n"; my $return_val_b = bx(); print "b - [$return_val_b]\n";
where you can see the difference a() returns one and b() returns the valus of the variable.234 a - [1] b - [234]
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Print Vs Return In a Subroutine
by heatblazer (Scribe) on Mar 30, 2012 at 18:06 UTC | |
by wwe (Friar) on Mar 31, 2012 at 21:49 UTC |