open(DATA,"myfile") or die "No, can't open the file"; while() { my @elements = split('\|',$_); # do something with the elements here }