I guess I have to tell the subroutine to find the definition of the struct elsewhere instead of redefining it
As the parameter you're passing to that function already is an object (blessed reference), there's no need to tell Perl where to find its definition. It already knows...
my $mystruct = new Structname; $mystruct = $ARGV[0];
The second line overwrites the object — thus creating it in the first place seems rather useless.
Also, I guess you meant $_[0] instead of $ARGV[0].
In reply to Re: Error with using structs as subroutine parameters
by almut
in thread Error with using structs as subroutine parameters
by dellnak
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |