What is the difference when calling subroutine with and without & in Perl? -
for homework, told make subroutine within perl, , when called arguments in it, print arguments. did , second part of homework call first subroutine within second one. did this, question was: try running second subroutine "&" while calling first one, , without , write difference in these 2 different calls. subroutine seems works in both cases, , without, don't know changed, therefore don't know write. off topic, code fine? kinda first time coding in perl.
this code:
#!/usr/bin/perl use 5.010; use strict; use warnings; show_args('fred','barney','betty'); show_args_again(); sub show_args{ ($broj1, $broj2, $broj3) = @_; print "the arguments are: " . "$broj1, " . "$broj2, " . "$broj3.\n"; } sub show_args_again{ &show_args('fred','barney','betty'); }
does assignment whether show_args_again
should called parameters?
the thing can think of meant discover demonstrated code. give try
#!/usr/bin/perl use 5.010; use strict; use warnings; show_args('fred', 'barney', 'betty'); print "---\n"; show_args_again('fred', 'barney', 'betty'); sub show_args{ ($broj1, $broj2, $broj3) = @_; no warnings 'uninitialized'; print "the arguments are: $broj1, $broj2, $broj3.\n"; } sub show_args_again { show_args(@_); &show_args(@_); show_args(); &show_args(); show_args; &show_args; }
Comments
Post a Comment