Is that same as the OPs code?
No, it shows another technique of accomplishing the desired result.
Is @ARGV is a substitute for @_?
No. See perlvar. @ARGV holds the command line arguments given to the script, @_ holds the arguments given to the subroutine. Interestingly, operators like shift know to work on @_ inside subroutines and on @ARGV in the main execution block. So the following two scripts will show the same output:
printf "Got %s!\n", shift while @ARGV;
use subs qw(printfor);
printfor @ARGV;
sub printfor {
my $f = shift;
printf "Got %s!\n", shift while @_;
}
Is print a substitute for return?
No. return is used inside subroutines to give back data to the calling code, print is used to generate output, which could be sent to the screen or a file handle, or it could be passed to function as another program's input using pipeline constructions. Among other things
Is a program a substitute for a subroutine?
Not really, although it's definitely possible to make another program do some work for you as if it were a subroutine. Shell scripting often works like that.