Calling sprintf() while legal, is not necessary. printing a string to another hunk of memory and returning that is an unnecessary step. There are some uses of sprintf() in Perl, but they are very, very rare.sub a { return sprintf("%s", $_[0]); }
return $_[0]; return "this is string $some_var";
In reply to Re^2: Print Vs Return In a Subroutine
by Marshall
in thread Print Vs Return In a Subroutine
by remya
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |