#!/usr/bin/perl -w use strict; while () { if (/\${4}/) { print "End of record\n"; last; } next unless /^> <([^>]+)>$/; my $tag = $1; chomp( my $property = ); print "tag: $tag property: $property\n"; } __DATA__ (+)-catechin SMI2MOL 21 23 0 0 0 0 0 0 0 0999 V2000 0.0000 0.0000 0.0000 O 0 0 0 0 0 0 0 0 0.0000 0.0000 0.0000 C 0 0 1 0 0 0 0 0 0.0000 0.0000 0.0000 C 0 0 0 0 0 0 0 0 1 2 1 0 0 0 0 2 13 1 0 0 0 0 19 21 1 0 0 0 0 M END > <$NAM> (+)-catechin > C15H14O6 > 290.26806 > 1254 > (+)-catechin > 219250 > 210205 $$$$