use warnings; use strict; open LABELS, '<', 'labellist.txt' or die "I could not get at labellist.txt as input: $!"; while ( ) { my ( $lotnumber, $product ) = /^(\w\d{7})\t(\w{6,9})$/ or next; print "^XA^LH30,30^FO110,65^A0,N,100^FD$lotnumber^FS^FO150,160^BY2,3.0^B3N,N,125,N,N^FD$lotnumber^FS^FO75,375^A0,N,50,30^FD$product^FS^FO30,425^BY2,2.0^B3N,N,50,N,N^FD$product^FS^XZ\n"; } close LABELS;