in reply to Regex question
or you could get fancier and do:while (<>) { my @params = split /\s*,\s*/; foreach my $param (@params) { $param =~ /(Identities|Positives|Negatives)\s+=\s+(.+)\s+\((.+)\%\ +)/; # $1 now contains which type you matched, $2 and $3 are the submat +ches, do what you will with them } }
and get a hash of all your params in one fell swoop.while (<>) { my %params = map { my ($k,$v) = split /\s*=\s*/; $v =~ /(.+)\s+\((.+)\%\)/; ($k => [$1,$2]) } split /\s,\s*/; }
|
|---|