## Ruby 1.9, 159

This program generates files named "1", "2", "3" and so on.

    b={}
    I=1
    eval T="$<.each{|l|c,d=l.split
    d ?c==?*?b={}:c==?!?b.delete(d):c==???puts(b[d]):b[c]=d :break}
    open(I.to_s,?w){|f|f<<'b=%p
    I=%d
    eval T=%p'%[b,I+1,T]}"