Yay, I finally learned how to get screwed by Perl
- From: "Lost Sheep Of the Porn" <cdalten@xxxxxxxxx>
- Date: 29 Oct 2006 16:50:47 -0800
Hell, I didn't even have to have my gf dress me up and put makeup on me
for this kind of screw job either.
#!/usr/bin/perl -w
package Person;
#Please note that new() and name() are taken from perltoot.
sub new {
my $self = {};
$self->{NAME} = undef;
$self->{AGE} = undef;
$self->{PEERS} = [];
bless($self);
return $self;
}
sub name {
my $self = shift;
if (@_) { $self->{NAME} = shift }
return $self->{NAME};
}
package main;
$him = Person->new();
$him->{NAME} = "Chad";
print "The name is: ", $him->name , "\n";
$./person.pl
The name is: Chad
Somewhere buried in all this technical crap, there was a section on
using closures to avoid this kind of screw job. I might try to find it,
because the solution presented in the Perl Cookbook is too complicated.
Ie, I haven't quite figured out the whole regular expression thingy yet.
.
- Prev by Date: Re: Need help w/ reqexp, capture and substitue
- Next by Date: Re: Need help w/ reqexp, capture and substitue
- Previous by thread: Need help w/ reqexp, capture and substitue
- Next by thread: Simple calendar
- Index(es):
Relevant Pages
|