$line=; # Just plain wrong! while ($line=~m/([123]?[.s]*[a-z\=.]+)/oi) # Where does $line get a value? $t_book=~s/\l=([a-z]+)\/$1/ig; # The \/ is wrong! $t_book=~s/<(|/)(B|I|SC|U)>//ig; # The |/ is wrong (and why would you want to capture it?)