On Mon, 2003-02-24 at 08:21, [EMAIL PROTECTED] wrote:
> $data[0] = \bless( {'data1' => 'foo',
>    'data2' => 'bar'}, 'TFB');

try these two examples:

$data[0] = \bless( {'data1' => 'foo', 'data2' => 'bar'}, 'TFB');
$data[1] = bless( {'data1' => 'foo', 'data2' => 'bar'}, 'TFB');
print $data[0] ."\n";
print $data[1] ."\n";


you'll see that only the second produces an object: the first produces a
reference to the object, which must be dereferenced before you can call
a method on it.

>   $data[0]->show;     # This won't work, it sais "Can't call method "show" on 
> unblessed reference"

This is what happens when you call a method on a reference, rather than
the object itself.

-- 
Nigel Wetters <[EMAIL PROTECTED]>
Perl Developer, Sun Certified Java Programmer
123 Ravensbury Road, London SW18 4RY
Tel. 020 8944 8633   <PGP: pgp.mit.edu>


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to