#! /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"; } }