#!/usr/bin/perl $pattern = shift(@ARGV); # Extract first argument into pattern open(CMP,"cmp.txt") || die "Can't find cmp.txt: $!\n"; while () { # treat the rest of @ARGV as filenames. if (/^$pattern\t/i) { # If the pattern matches... ($name,$C,$H,$N,$O,$Cl,$Br,$I,$S,$MW,$D,$ND,$BP,$MP,$W1,$AB1,$W2,$AB2,$W3,$AB3, $UVS,$UVRef,$PRef,$IRRef,$NMRRef,$MSRef,$MS1,$MS2,$MS3,$MS4,$CO,$AR,$HT,$QH) = split ; print " $name\n" ; if ( $C != 0 ) { print " C$C" } ; if ( $H != 0 ) { print " H$H" } ; if ( $N != 0 ) { print " N$N" } ; if ( $O != 0 ) { print " O$O" } ; if ( $Cl != 0 ) { print " Cl$Cl" } ; if ( $Br != 0 ) { print " Br$Br" } ; if ( $I != 0 ) { print " I$I" } ; if ( $S != 0 ) { print " S$S" } ; print " M.W. $MW g/mol\n" ; if ( $D != 999 ) { print " density $D g/mL" } ; if ( $ND != 999 ) { print " index refraction nD(20) $ND\n" } ; if ( $BP != 999 ) { print " boiling point(760) $BP degC" } ; if ( $MP != 999 ) { print " melting point $MP degC\n" } ; print "\n"; if ( $W1 != 0 ) { print " UV wavelengths and molar absorptivities: " ; print " $W1($AB1),$W2($AB2),$W3($AB3)\n" ; $sl[1] = "methanol" ; $sl[2] = "cyclohexane" ; $sl[3] = "hexane" ; $sl[4] = "ethanol" ; $sl[5] = "water" ; $sl[6] = "chloroform" ; $sl[7] = "dioxane" ; print " UV solvent: $sl[$UVS]\n" ; print " UV ref. $UVRef\n" ; } print " Properties Ref. $PRef\n" ; print " IR ref. $IRRef\n" ; print " NMR ref. $NMRRef\n" ; print " Mass Spec. ref. $MSRef\n" ; print " Four biggest peaks in Mass Spec: $MS1,$MS2,$MS3,$MS4 m/e\n" ; print " Functional Types:\n" ; if ( $CO == 1 ) { print " Carbonyl\n" } ; if ( $AR == 1 ) { print " Aryl\n" } ; if ( $HT == 0 ) { print " no C-H protons\n" } ; if ( $HT == 1 ) { print " saturated CH\n" } ; if ( $HT == 2 ) { print " unstaurated CH\n" } ; if ( $HT == 3 ) { print " both saturated and unsaturated CH\n" } ; if ( $QH == 1 ) { print " OH or NH\n" } ; } }