open IF, "$thefile" or die "Can't open $thefile: $!\n"; # note the 'or die' my @lines = ; #load file into array, line by line close IF; foreach (@lines) { my @array = split ";", $_, -1; # no upper limit on # of items # process @array foreach my $item (@array) { #process $item } }