while(my $line = ) { #grep 'DataDictionary' next unless $line =~ /DataDictionary/; #awk -F'' {print $1} my @aFields = split(//, $line); my $sFieldICareAbout = $aFields[0]; #$1 in awk #awk '{print $3}' @aFields = split(/\s/, $sFieldICareAbout); $sFieldICareAbout = $aFields[2]; #$3 in awk #awk -F'>' '{print $1}' @aFields = split(/>/, $aFields[2]); $sFieldICareAbout = $aFields[0]; #$1 in awk print "$sFieldICareAbout\n"; } __DATA__ *** *** G1>H>IDataDictionary Whan that aprill with his shoures soote The droghte of march hath perced to the roote, And bathed every veyne in swich licour Of which vertu engendred is the flour; *** *** G2>H>IDataDictionary Whan zephirus eek with his sweete breeth Inspired hath in every holt and heeth Tendre croppes, and the yonge sonne Hath in the ram his halve cours yronne, And smale foweles maken melodye, That slepen al the nyght with open ye (so priketh hem nature in hir corages); *** *** G3>H>IDataDictionary Thanne longen folk to goon on pilgrimages, And palmeres for to seken straunge strondes, #### while() { print "$1\n" if /^\S+\s+\S+\s+([^>]+).*.*DataDictionary/; }