Skip to content

Instantly share code, notes, and snippets.

@mmisono
Created January 20, 2010 13:10
Show Gist options
  • Save mmisono/281829 to your computer and use it in GitHub Desktop.
Save mmisono/281829 to your computer and use it in GitHub Desktop.
snippet perl
#!/opt/local/bin/perl
use strict;
use warnings;
${1}
snippet sub
sub ${1:function_name} {
${2:# body...}
}
snippet if
if (${1}) {
${2:# body...}
}
snippet ife
if (${1}) {
${2:# body...}
} else {
${3:# else...}
}
snippet ifee
if (${1}) {
${2:# body...}
} elsif (${3}) {
${4:# elsif...}
} else {
${5:# else...}
}
snippet xif
${1:expression} if ${2:condition};
snippet while
abbr wh
while (${1}) {
${2:# body...}
}
snippet xwhile
abbr xwh
${1:expression} while ${2:condition};
snippet for
for (my $${1:var} = 0; $$1 < ${2:expression}; $$1++) {
${3:# body...}
}
snippet fore
for ${1} (${2:expression}){
${3:# body...}
}
snippet xfor
${1:expression} for @${2:array};
snippet unless
abbr un
unless (${1}) {
${2:# body...}
}
snippet xunless
abbr xun
${1:expression} unless ${2:condition};
snippet eval
eval {
${1:# do something risky...}
};
if ($@) {
${2:# handle failure...}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment