in reply to Error with using structs as subroutine parameters
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].
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Error with using structs as subroutine parameters
by dellnak (Initiate) on Jun 08, 2009 at 08:53 UTC | |
by almut (Canon) on Jun 08, 2009 at 09:08 UTC |