Created
January 25, 2014 18:57
-
-
Save mtimkovich/8621529 to your computer and use it in GitHub Desktop.
String to Array
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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