in reply to Re: handling tab delimited files
in thread handling tab delimited files

$df = is the user input value. so if i enter 10 $df = 10. $ val is giving the output as 111111. so something is wrong here. the file looks like this
0.250 0.413 0.432 0.345 0.786 1.001 0.987 0.984 0.125 0.678 0.243 0.657 0.342 0.743 0.986 0.734 0.764 0.650 0.457 0.965 0.836

Replies are listed 'Best First'.
Re^3: handling tab delimited files
by toolic (Bishop) on May 05, 2010 at 17:30 UTC
    When I copied your data, I get single spaces instead of tab characters. Try to use split as follows:
    use strict; use warnings; my $df = 10; while (<DATA>) { chomp $_; my @values = split; foreach my $val (@values) { my $DNA_conc = $val * $df * 50; print $DNA_conc; print "\n"; } } __DATA__ 0.250 0.413 0.432 0.345 0.786 1.001 0.987 0.984 0.125 0.678 0.243 0.657 0.342 0.743 0.986 0.734 0.764 0.650 0.457 0.965 0.836

    This is the output I get:

    125 206.5 216 172.5 393 500.5 493.5 492 62.5 339 121.5 328.5 171 371.5 493 367 382 325 228.5 482.5 418