Main Content

Blessing in Perl / Member variable in Ruby

Archive - Originally posted on "The Horse's Mouth" - 2006-12-14 16:47:26 - Graham Ellis

How do you decide what member variables you have in an object in Ruby? Well - in Perl, you bless a single hash (or, exceptionally, a list or a scaler), but in Ruby you refer to each variable that you wish to be a member of each object using a preceeding @ character.

Perl:

bless \%abc;

Ruby:

@abc = ...