Permalink
Browse files

Perl: print quotes at the end of the file, but use BEGIN

  • Loading branch information...
1 parent d592129 commit 64aa7378653ae52980aa34b5f46f2bf6f51c4f69 @avar committed Sep 23, 2010
Showing with 5 additions and 4 deletions.
  1. +5 −4 lib/App/QuoteCC/Output/Perl.pm
@@ -83,12 +83,13 @@ __DATA__
__[ program ]__
#!/usr/bin/env perl
-our @QUOTES = ([% FOREACH quote IN quotes %]<<'----[% loop.count %]----8========D',[% END %]);
-[% FOREACH quote IN quotes %][% quote %]
-----[% loop.count %]----8========D
-[% END %]
if (@ARGV && $ARGV[0] eq '--all') {
print for @QUOTES;
} else {
print $QUOTES[rand @QUOTES];
}
+
+BEGIN { our @QUOTES = ([% FOREACH quote IN quotes %]<<'----[% loop.count %]----8========D',[% END %]); }
+[% FOREACH quote IN quotes %][% quote %]
+----[% loop.count %]----8========D[% UNLESS loop.last %]
+[% END %][% END %]

0 comments on commit 64aa737

Please sign in to comment.