H
Helmut Richter
What is the difference of
- calling a procedure to get a result, and *then* printing the result
and
- calling a procedure as a parameter of print?
Example:
----> cat ./tt
#! /usr/bin/perl
print "\nfirst try:\n";
$z = proc (1);
print $z;
print "\nsecond try:\n";
print (proc (1));
sub proc {
return "result\n";
};
----> ./tt
first try:
result
second try:
---->
I expected twice the same result.
- calling a procedure to get a result, and *then* printing the result
and
- calling a procedure as a parameter of print?
Example:
----> cat ./tt
#! /usr/bin/perl
print "\nfirst try:\n";
$z = proc (1);
print $z;
print "\nsecond try:\n";
print (proc (1));
sub proc {
return "result\n";
};
----> ./tt
first try:
result
second try:
---->
I expected twice the same result.