Excerpt from HOP sub tokens { my $target = shift; return sub { TOKEN: { return ['INTEGER', $1] if $target =˜ /\G (\d+) /gcx; return ['PRINT'] if $target =˜ /\G print \b /gcx; return ['IDENTIFIER', $1] if $target =˜ /\G ([A-Za-z_]\w*) /gcx; return ['OPERATOR', $1] if $target =˜ /\G (\*\*) /gcx; return ['OPERATOR', $1] if $target =˜ /\G ([-+*\/=()])/gcx; return ['TERMINATOR', $1] if $target =˜ /\G (; \n* | \n+) /gcx; redo TOKEN if $target =˜ /\G \s+ /gcx; return ['UNKNOWN', $1] if $target =˜ /\G (.) /gcx; return; } }; } ----------------------------------------------------- cipher text 1 ciphertxt2 ciphertxt3 | | | +-------------+ +----------+ +---- | | | | | key--decryption | decrypt | decrypt | | | | | -------X +--X +----------X | | | plaintext 1 plntxt2 plntxt3