Skip to content

Instantly share code, notes, and snippets.

@jrockway
Created January 2, 2011 10:21
Show Gist options
  • Save jrockway/762441 to your computer and use it in GitHub Desktop.
Save jrockway/762441 to your computer and use it in GitHub Desktop.
use strict;
use 5.010;
{ package Class;
sub new { my $self = bless $_[1], $_[0]; warn $self; $self }
sub DESTROY { warn $_[0] }
}
# works
{
my $hash = Class->new({});
warn $hash;
}
# works
{
my $forty_two = do { 42 };
my $scalar = Class->new(\$forty_two);
warn $scalar;
}
# blows up
{
my $forty_two = \do { 42 };
my $scalar = Class->new($forty_two);
warn $scalar;
}
warn "end"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment