in reply to How can I remove unwated parts of a string in a pattern match?

If no quoting and escaping is involved, you can just split on semicolon:
#! /usr/bin/perl use warnings; use strict; my @strings = ('4;T;X;15;O20;O26.0;O26.0;O260;Excessive weight gain in + pregnancy;242;UNDEF;UNDEF;2-067;1-089', '4;T;X;15;O20;O26.1;O26.1;O261;Low weight gain in pregn +ancy;242;UNDEF;UNDEF;2-067;1-089'); for my $string (@strings) { my $text = (split /;/, $string)[8]; print $text, "\n" if $text =~ /weight gain/; }

Otherwise, see Text::CSV.

($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,