Skip to content

Instantly share code, notes, and snippets.

@mtimkovich
Created January 25, 2014 18:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mtimkovich/8621529 to your computer and use it in GitHub Desktop.
Save mtimkovich/8621529 to your computer and use it in GitHub Desktop.
String to Array
#!/usr/bin/env perl
use strict;
use warnings;
my $string = "array downto function of repeat until begin else goto packed set var case end if procedure then while const file label program to with do for nil record type";
my @reserved = split /\s+/, $string;
my $array = join ",", map { '"'.$_.'"' } @reserved;
$array = "{" . $array . "}";
print $array;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment