Skip to content

Instantly share code, notes, and snippets.

@MadMartigan
Created October 29, 2013 16:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MadMartigan/7218147 to your computer and use it in GitHub Desktop.
Save MadMartigan/7218147 to your computer and use it in GitHub Desktop.
How to loop through an arrayref returned from a helper directly in a template
# the helper
$app->helper(
testarray => sub {
my $self = shift;
my @array = ("Quarter","Dime","Nickel");
return \@array;
}
);
%# in the template
% my $arrayref = testarray;
% for (@$arrayref) {
<%= $_ %> <br>
% }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment