http://www.perlmonks.org?node_id=527314


in reply to Re^2: To call a sub from another sub
in thread To call a sub from another sub

Perhaps you want this :
sub subroutine_1 { my $val = subroutine_2(); print "$val this is subroutine_2 output!"; } sub subroutine_2 { return "w00t!"; }
It does not pass it back to subroutine_2 but should give you a rough idea of how things like these work.

Replies are listed 'Best First'.
Re: To call a sub from another sub
by jonadab (Parson) on Feb 02, 2006 at 12:26 UTC
    Two points:
    • You missed the part where a value is passed in, processed, and returned.
    • Don't just hand him complete working code. He made no attempt to write any code himself, and he won't learn anything until he does, and it's obviously homework, the first assignment of the semester by the look of it.