$step1 1 $step2 1 $step3 1 #### #!/usr/bin/perl my $step1; my $step2; my $step3; my @array1; my @array; my $i = 0; open(FILE, "assign"); $line = ; while ($line ne ""){ chomp($line); if($line =~ /^(\S+)\s+(\d+)$/) { print "inside\n"; $hash{$1} = $2; $i++; } $line = ; } while( ($key, $value) = each %hash) { print "$key +> $value\n"; $key = $value; } if($step1){ print "first\n"; } if($step2) { print "second\n"; } if($step3) { print "thisrd\n"; }