Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^2: Array definition error

by RazorbladeBidet (Friar)
on Apr 15, 2005 at 15:47 UTC ( #448236=note: print w/replies, xml ) Need Help??


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."

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://448236]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (6)
As of 2020-10-20 15:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My favourite web site is:












    Results (210 votes). Check out past polls.

    Notices?