#!/usr/bin/perl -w use strict; my @x; # your x values my @y1; # your y values my @y2; my @y3; my @y4; die unless open FH, 'file.txt'; # whatever your data file # is my $count=0; while (my $line = ){ ($x[$count], $y1[$count], $y2[$count], $y3[$count], $y4[$count]) = split ' ', $line; # split on space to get # your values in an array $count++; } close FH; print "X:@x\n1:@y1\n2:@y2\n3:@y3\n4:@y4\n";