open my $filehandle, '>>', 'C:\Documents and Settings\m\Desktop\info.txt' #### foreach my $key (qw/name Specialization age/){ print "enter your $key\n"; $info{$key} = ; chomp $info{$key}; # get rid of the EOL print $filehandle "$key: $info{$key}\n"; } #### while (<>) { ... # code for each line } #### unshift(@ARGV, '-') unless @ARGV; while ($ARGV = shift) { open(ARGV, $ARGV); while () { ... # code for each line } }