Skip to content

Instantly share code, notes, and snippets.

@worr
Created May 24, 2011 19:38
Show Gist options
  • Select an option

  • Save worr/989510 to your computer and use it in GitHub Desktop.

Select an option

Save worr/989510 to your computer and use it in GitHub Desktop.
State vars in perl 5.8.8
#!/usr/bin/env perl
use strict;
use warnings;
use 5.008;
{
my $var;
sub state_sub {
if (not defined $var) {
$var = { test => 'hash' };
}
# Do your thing here
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment