#!/usr/bin/perl use strict; use warnings; # but you really don't want to do this # stick with a hash! # here we have 3 vars, but what if if there's more than 3? my ($step1,$step2,$step3); while () { my $line = $_; chomp $line; my ($var,$val) = split / /, $line; eval "$var=$val"; } # here we have 3 vars, but what if if there's more than 3? print $step1 . "\n"; print $step2 . "\n"; print $step3 . "\n"; __DATA__ $step1 1 $step2 1 $step3 1