I'm interested in how Perl handles functions, especially if you'd like to return more than one parameter back to the program. I'm primarily interested in how to handle this as cleanly as one can. Can you show me ? C++ example below:
#include <iostream>
using namespace std;
struct tuple
{
int x,y;
};
tuple increment_tuple(int x,int y)
{
tuple tmp_tuple;
tmp_tuple.x=x+1;
tmp_tuple.y=y+1;
return tmp_tuple;
}
void main()
{
tuple mytuple;
mytuple=increment_tuple(3,4);
cout<<mytuple.x<<" "<<mytuple.y<<endl; // 4 5
}
|