my $m = [[],[]]; while ( ) { chomp; my @l = split /,\s+/; push @{$m->[0]}, $l[0]; push @{$m->[1]}, $l[1]; } $m = PDL::Matrix->pdl($m); __DATA__ 0.6490, 0.0330 0.1150, 0.0290 0.0070, 0.3570 0.0630, 0.0760 0, 0.0400 0.0120, 0.0620 0.1530, 0.4020