- or download this
use strict;
use warnings;
...
STR
open my $fIn, '<', $fileStr or die "Couldn't open \$fileStr: $!\n";
- or download this
# Look for the empty line between records
local $/ = "\n\n";
while (defined (my $record = <$fIn>)) {
- or download this
my %recordData = map{split /\s+/, $_} grep {length $_} split "\n",
+ $record;
my @solvents = grep {/^solvent\d+/} keys %recordData;
my @fractions = grep {/^F\d+/} keys %recordData;
- or download this
my ($zeroSolvent) = grep {!$recordData{$_}} @solvents;
- or download this
print "${zeroSolvent}_$_ => $recordData{$_}\n" for @fractions;
}
- or download this
solvent1_F101 => 3.2
solvent1_F001 => 1.2
solvent2_F101 => 7.2
solvent2_F001 => 2.2
- or download this
use strict;
use warnings;
...
print "${zeroSolvent}_$_ => $recordData{$_}\n" for @fractions;
}