... open OUT, ">", "outfile.name" or die "outfile.name: $!\n"; ... print OUT $DNA_conc; # and so on... #### # don't do this: # print " Enter the number. \n"; # chomp ($df = ); # do this instead: die "Usage: $0 multiplier_value\n" unless ( @ARGV == 1 and $ARG[0] =~ /([\d.]+)/ ); my $df = $1; #### your_script_name 10.5 > outfile.name #### #!/usr/bin/perl use strict; use Regexp::Common; die "Usage: $0 multiplier_number [input.file]\n" unless ( @ARGV and $ARGV[0] =~ /^$RE{num}{real}$/ ); my $df = shift; # take the numeric arg off @ARGV while (<>) # read from STDIN, or from file(s) named in @ARGV { if ( ! /^\s*(?:$RE{num}{real}\s+)+$/ ) { # if line has non-numerics print; } else { my @vals = map { $_ * $df * 50 } split; print join( "\t", @vals ), "\n"; } } #### script_name 10 input.txt > 10_x_50_x_input.txt