in reply to Re: Array definition error
in thread Array definition error
That works... or...(if this is even a necessary step)
use strict; use warnings; use Data::Dumper; my @trainset = (); while (my $pattern = <DATA>) { chomp $pattern; next if ($pattern =~ /#/); my ($inputs,$outputs) = split(/=>/,$pattern); my @inputs = split(/,/,$inputs); my @outputs = split(/,/,$outputs); $_+0 foreach @outputs; # added $_+0 foreach @inputs; # added $trainset[scalar(@trainset)] = \@inputs; $trainset[scalar(@trainset)] = \@outputs; } print Dumper(\@trainset); my @set = ( [0,0] => [0], [0,1] => [1], ); print Dumper(\@set); __DATA__ 0,0=>0 0,1=>1 #not used
--------------
"But what of all those sweet words you spoke in private?"
"Oh that's just what we call pillow talk, baby, that's all."
"But what of all those sweet words you spoke in private?"
"Oh that's just what we call pillow talk, baby, that's all."
|
---|
In Section
Seekers of Perl Wisdom