# assuming the link data file is open my $keywords; while () { # regex matches (everything to the left of the pipe), puts # it in $1, then (everything to the right of the pipe) # and puts that in $2 /([^|]+)\|(.*)/; $keywords{$1} = $2; }