Almost right,
is what you want though. The references $fn_x and $fn_y should be dereferenced if you want to access/change the values they refer to. For a scalar, dereferencing is done with $, while @, % and & are used to dereference lists, hashes and functions respectively. E.g. suppose that $r_list is a reference to a list, you'd get the list it refers to using @$r_list while you'd get the second element of the list using $r_list->[1].sub fn { my ($fn_x, $fn_y) = @_; ($$fn_x, $$fn_y) = ('x', 'y'); my $rc = 0; $rc = 1 if $$fn_x ne 'x'; return 0; }
For the ocmplete story, have a look at perlref.
Incidently, you might want to die inside the function fn since this is where the exception actually occurs. The if statement can be replaced by eval {...}; and you can test for an error by checking the value of the variable $@.
Hope this helps, -gjb-
In reply to Re: Parameter passing
by gjb
in thread Parameter passing
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |