This is my code:
#!/usr/bin/perl -w
use strict;
use Class::Struct;
struct App =>
{
name => '$',
};
sub App::name
{
my $self = shift;
if( @_ )
{
$self->{'name'} = shift;
}
return $self->{'name'};
}
my $x = App->new( name => "John" );
printf("Hello %s\n", $x->name);
When I run the script I get:
Why won't it save the name (John)???