# NOTE: untested! while() { my ($key, $val) = /^([^:]+):\s*([\n#]+)/; &do_stuff_with($key, $val); }