#!/usr/bin/perl -w use strict; my @code = ; my $code = join "" , @code; eval $code; my $stuff = Foo->new('RedCar'); print $stuff->{bar}; __DATA__ package Foo; sub new { my $self= shift; my $val = shift; my %hash =( bar=> $val);; return bless { %hash}, $self; }