#!/usr/bin/perl use strict; # https://perlmonks.org/?node_id=11144249 use warnings; open my $fh, '<', \<<END; # FIXME with normal open F001 1.2 F101 3.2 solvent1 0 solvent2 3 three lines of text that are not important and can be skipped F001 2.2 F101 7.2 solvent1 5 solvent2 0 END local $_ = do{ local $/; <$fh> }; # slurp entire file my %solvent_face; $solvent_face{ "$3_$1" } = $2 while /\b (F\w+) \h+ ([\d.]+) (?=.*? ^ (\S+) \h+ 0 \h* \n )/gmsx; use Data::Dump 'dd'; dd \%solvent_face;
In reply to Re: Help with parsing a file
by tybalt89
in thread Help with parsing a file
by Odar
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |