diff --git a/snippets/perl.snippets b/snippets/perl.snippets index 4c3bb16..c85ff11 100644 --- a/snippets/perl.snippets +++ b/snippets/perl.snippets @@ -1,7 +1,7 @@ -# #!/usr/bin/env perl +# #!/usr/bin/perl snippet #! - #!/usr/bin/env perl - + #!/usr/bin/perl + # Hash Pointer snippet . => @@ -19,16 +19,19 @@ snippet if snippet ife if (${1}) { ${2:# body...} - } else { + } + else { ${3:# else...} } # Conditional if..elsif..else snippet ifee if (${1}) { ${2:# body...} - } elsif (${3}) { + } + elsif (${3}) { ${4:# elsif...} - } else { + } + else { ${5:# else...} } # Conditional One-line @@ -58,32 +61,35 @@ snippet wh # While Loop One-line snippet xwh ${1:expression} while ${2:condition};${3} -# For Loop -snippet for +# C-style For Loop +snippet cfor for (my $${2:var} = 0; $$2 < ${1:count}; $$2${3:++}) { ${4:# body...} } +# For loop one-line +snippet xfor + ${1:expression} for @${2:array};${3} # Foreach Loop -snippet fore +snippet for foreach my $${1:x} (@${2:array}) { ${3:# body...} } # Foreach Loop One-line -snippet xfore +snippet fore ${1:expression} foreach @${2:array};${3} # Package snippet cl package ${1:ClassName}; - + use base qw(${2:ParentClass}); - + sub new { my $class = shift; $class = ref $class if ref $class; my $self = bless {}, $class; $self; } - + 1;${3} # Read File snippet slurp