#!/usr/bin/perl -w use strict; # declare your variables my $varFile = "variables.txt"; my ($var1,$var2,$var3); # open the file open DATA, $varFile or die "Can't open file: $!"; while () { # chomp the line chomp; # split the line into values and assign them to your variables ($var1,$var2,$var3) = split /\|/; } # close the file close DATA;