#!/usr/bin/env perl use strict; use warnings; use Parse::RecDescent; use Data::Dumper; my $grammar = <<'END'; foo: word(s) word: /\S+/ { push @{$thisparser->{local}}, lc $item[1]; $return = uc $item[1]; } END my $parser = Parse::RecDescent->new($grammar); my $what = $parser->foo("Foo bAr baZ"); print Dumper $what, $parser->{local}; __END__ $VAR1 = [ 'FOO', 'BAR', 'BAZ' ]; $VAR2 = [ 'foo', 'bar', 'baz' ];