For my homework, I was told to make a routine inside Perl, and when it is called with arguments in it, it will print the arguments. I did this, and the second part of my homework was to call this first subroutine in the second. Therefore, I did all this, but then the question arose: try to start the second subroutine with & calling the first, and without it, and write what is the difference in these two different calls. Thus, the subroutine works fine in both cases, with and without, but I just don’t know that this has really changed, so I don’t know what to write. Off, does my code look fine? First time coding in this Perl.
This is the code:
use 5.010;
use strict;
use warnings;
show_args('fred','barney','betty');
show_args_again();
sub show_args{
my ($broj1, $broj2, $broj3) = @_;
print "The arguments are: " . "$broj1, " . "$broj2, " . "$broj3.\n";
}
sub show_args_again{
&show_args('fred','barney','betty');
}
source
share