Skip to content

Instantly share code, notes, and snippets.

@JRaspass
Created June 9, 2020 09:30
Show Gist options
  • Save JRaspass/5adacfd08ba6081f4f7e1bc68be72456 to your computer and use it in GitHub Desktop.
Save JRaspass/5adacfd08ba6081f4f7e1bc68be72456 to your computer and use it in GitHub Desktop.
my $date = '09 May 2008';
constant %months = enum «:1Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec»;
$date ~~ / $<day> = \d+ ' ' $<month> = @( %months.keys ) ' ' $<year> = \d+ /;
say Date.new: |$/.hash, :month( %months{ $<month> } );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment