Skip to content

Instantly share code, notes, and snippets.

View opendevnet's full-sized avatar

Open Development Network opendevnet

  • Ottawa, Canada
View GitHub Profile
sub escape ($str) {
# Puts a slash before non-alphanumeric characters
S:g[<-alpha -digit>] = "\\$/" given $str
}
say escape 'foo#bar?'; # foo\#bar\?
{
sub escape ($str) {
# Writes each non-alphanumeric character in its hexadecimal escape