in reply to Newbie Question

Hi,

Perhaps the following might help?


@stuff = ( "myfirstvar" );
%nums = ( 'myfirstvar', 1 );
if ( exists $nums{ $stuff[0] } ) { print "howdy!"; }


It appears that 'stuff' is an array. You're dereferencing
the first element of that array and then deteferencing
a hash element based on what's stored in the array's
element. ie: Suppose that "foo" is stored in the first
element of the array 'stuff', then you're deteferencing
the element with the index 'foo' in the 'nums' hash
table. You are essentially checking, if that index in
that hashtable exists. If it does, then do ...

Ozy

Replies are listed 'Best First'.
Re^2: Newbie Question
by toolic (Bishop) on Feb 18, 2009 at 14:59 UTC
    <nitpick>

    I believe you are misusing the term "dereference". I think it would be more accurate to use the term "subscript". Refer to Subscripts and perlreftut for the distinction.