in reply to Re^2: handling tab delimited files
in thread handling tab delimited files
As $val = @values assigns the number of elements in the array to $val, your output confirms my suspicion, i.e. that the lines aren't tab separated, so you get only one value in @values (the entire line) from the split.
Try splitting on whitespace:
#!/usr/bin/perl use strict; use warnings; print " Enter the dilution factor. \n"; chomp (my $df = <STDIN>); open FILE, "45well.txt" or die $!; while (<FILE>){ chomp; my @values = split ' '; foreach my $val (@values){ my $DNA_conc = $val * $df * 50 ; print "$DNA_conc\n"; } } close (FILE);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: handling tab delimited files
by shaludr (Initiate) on May 05, 2010 at 17:40 UTC | |
by almut (Canon) on May 05, 2010 at 17:47 UTC | |
by shaludr (Initiate) on May 05, 2010 at 20:41 UTC | |
by almut (Canon) on May 05, 2010 at 21:01 UTC | |
by shaludr (Initiate) on May 06, 2010 at 05:49 UTC | |
by toolic (Bishop) on May 05, 2010 at 20:52 UTC | |
by shaludr (Initiate) on May 05, 2010 at 17:53 UTC | |
by graff (Chancellor) on May 06, 2010 at 06:49 UTC |