proc lines {lines} {
foreach item [uplevel [list subst -nobackslash $lines]] {
lappend list $item
}
return $list
}
set another_pet fish;
set pets [lines {
cat
[string range hotdog 3 end]
elephant
$another_pet
"african pygmy hedgehog"
snapping\ turtle
"\"henry\" the bengali tiger"
}]
puts $pets
cHJvYyBsaW5lcyB7bGluZXN9IHsKICAgIGZvcmVhY2ggaXRlbSBbdXBsZXZlbCBbbGlzdCBzdWJzdCAtbm9iYWNrc2xhc2ggJGxpbmVzXV0gewogICAgICAgIGxhcHBlbmQgbGlzdCAkaXRlbQogICAgfQogICAgcmV0dXJuICRsaXN0Cn0KCnNldCBhbm90aGVyX3BldCBmaXNoOwoKc2V0IHBldHMgW2xpbmVzIHsKICAgIGNhdAogICAgW3N0cmluZyByYW5nZSBob3Rkb2cgMyBlbmRdCiAgICBlbGVwaGFudAogICAgJGFub3RoZXJfcGV0CiAgICAiYWZyaWNhbiBweWdteSBoZWRnZWhvZyIKICAgIHNuYXBwaW5nXCB0dXJ0bGUKICAgICJcImhlbnJ5XCIgdGhlIGJlbmdhbGkgdGlnZXIiCn1dCgpwdXRzICRwZXRz