Help for this page

Select Code to Download


  1. or download this
    use strict;
    use warnings;
    ...
    STR
    
    open my $fIn, '<', $fileStr or die "Couldn't open \$fileStr: $!\n";
    
  2. or download this
    # Look for the empty line between records
    local  $/ = "\n\n";
    
    while (defined (my $record = <$fIn>)) {
    
  3. 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;
    
  4. or download this
        my ($zeroSolvent) = grep {!$recordData{$_}} @solvents;
    
  5. or download this
        
        print "${zeroSolvent}_$_ => $recordData{$_}\n" for @fractions;
    }
    
  6. or download this
    solvent1_F101 => 3.2
    solvent1_F001 => 1.2
    solvent2_F101 => 7.2
    solvent2_F001 => 2.2
    
  7. or download this
    use strict;
    use warnings;
    ...
        
        print "${zeroSolvent}_$_ => $recordData{$_}\n" for @fractions;
    }