http://www.perlmonks.org?node_id=861236


in reply to pattern matching

Hi changalrai......i hope my following code will help you. Suppose that your data is in SOPW.txt file .The the following code will retrieve what you wanted.

#! /usr/bin/perl use strict; use warnings; open (my $fh, "<", "c:/SOPW.txt") or die "can't open the file :$!"; while (<$fh>){ chomp; if(m/\w+:(.*);/){ print "$1\n"; } }