chirpyform
Programmer
Hi,
I want to have a class perl that takes a line with a seperator ";" and stocks the result in a table that i can use later with getter and setter methodes.
ex
12;3;rrr;
would be stored in a table as
table[0]=12
table[1]=3
table[2]=rrr
I tried :
sub new
{
my ($class,$line,$sep) = @_;
my $this = {};
bless($this, $class);
print "sep : $sep \n line : $line";
$this->{sep} = $sep;
$this->{line} = $line;
$this->fields = split(/$this->{sep}/, $this->{line});
return $this;
}
sub getVar1()
{
my ($this) = @_;
return $this->fields[0];
}
but i have the impression that is not compatible :
Use of implicit split to @_ is deprecated at DRAP001_FENTREE1.pm line 13.
syntax error at DRAP001_FENTREE1.pm line 22, near "->fields["
syntax error at DRAP001_FENTREE1.pm line 33, near "->fields["
Compilation failed in require at DRAP001.pl line 3.
BEGIN failed--compilation aborted at DRAP001.pl line 3.
Can anybody help me please ?
Chris
I want to have a class perl that takes a line with a seperator ";" and stocks the result in a table that i can use later with getter and setter methodes.
ex
12;3;rrr;
would be stored in a table as
table[0]=12
table[1]=3
table[2]=rrr
I tried :
sub new
{
my ($class,$line,$sep) = @_;
my $this = {};
bless($this, $class);
print "sep : $sep \n line : $line";
$this->{sep} = $sep;
$this->{line} = $line;
$this->fields = split(/$this->{sep}/, $this->{line});
return $this;
}
sub getVar1()
{
my ($this) = @_;
return $this->fields[0];
}
but i have the impression that is not compatible :
Use of implicit split to @_ is deprecated at DRAP001_FENTREE1.pm line 13.
syntax error at DRAP001_FENTREE1.pm line 22, near "->fields["
syntax error at DRAP001_FENTREE1.pm line 33, near "->fields["
Compilation failed in require at DRAP001.pl line 3.
BEGIN failed--compilation aborted at DRAP001.pl line 3.
Can anybody help me please ?
Chris